diff --git a/__tests__/cmds/categories/create.test.ts b/__tests__/cmds/categories/create.test.ts index 3fec6e550..a9ed0aaf2 100644 --- a/__tests__/cmds/categories/create.test.ts +++ b/__tests__/cmds/categories/create.test.ts @@ -20,12 +20,14 @@ describe('rdme categories:create', () => { it('should prompt for login if no API key provided', async () => { const consoleInfoSpy = vi.spyOn(console, 'info').mockImplementation(() => {}); prompts.inject(['this-is-not-an-email', 'password', 'subdomain']); + // @ts-expect-error deliberately passing in bad data await expect(categoriesCreate.run({})).rejects.toStrictEqual(new Error('You must provide a valid email address.')); consoleInfoSpy.mockRestore(); }); it('should error in CI if no API key provided', async () => { process.env.TEST_RDME_CI = 'true'; + // @ts-expect-error deliberately passing in bad data await expect(categoriesCreate.run({})).rejects.toStrictEqual( new Error('No project API key provided. Please use `--key`.'), ); diff --git a/__tests__/cmds/categories/index.test.ts b/__tests__/cmds/categories/index.test.ts index 9693397a7..e13954d7f 100644 --- a/__tests__/cmds/categories/index.test.ts +++ b/__tests__/cmds/categories/index.test.ts @@ -20,12 +20,14 @@ describe('rdme categories', () => { it('should prompt for login if no API key provided', async () => { const consoleInfoSpy = vi.spyOn(console, 'info').mockImplementation(() => {}); prompts.inject(['this-is-not-an-email', 'password', 'subdomain']); + // @ts-expect-error deliberately passing in bad data await expect(categories.run({})).rejects.toStrictEqual(new Error('You must provide a valid email address.')); consoleInfoSpy.mockRestore(); }); it('should error in CI if no API key provided', async () => { process.env.TEST_RDME_CI = 'true'; + // @ts-expect-error deliberately passing in bad data await expect(categories.run({})).rejects.toStrictEqual( new Error('No project API key provided. Please use `--key`.'), ); diff --git a/__tests__/cmds/changelogs/index.test.ts b/__tests__/cmds/changelogs/index.test.ts index 72ab7fd38..78f6a5201 100644 --- a/__tests__/cmds/changelogs/index.test.ts +++ b/__tests__/cmds/changelogs/index.test.ts @@ -28,12 +28,14 @@ describe('rdme changelogs', () => { it('should prompt for login if no API key provided', async () => { const consoleInfoSpy = vi.spyOn(console, 'info').mockImplementation(() => {}); prompts.inject(['this-is-not-an-email', 'password', 'subdomain']); + // @ts-expect-error deliberately passing in bad data await expect(changelogs.run({})).rejects.toStrictEqual(new Error('You must provide a valid email address.')); consoleInfoSpy.mockRestore(); }); it('should error in CI if no API key provided', async () => { process.env.TEST_RDME_CI = 'true'; + // @ts-expect-error deliberately passing in bad data await expect(changelogs.run({})).rejects.toStrictEqual( new Error('No project API key provided. Please use `--key`.'), ); diff --git a/__tests__/cmds/changelogs/single.test.ts b/__tests__/cmds/changelogs/single.test.ts index fcc7589bd..2cdae62eb 100644 --- a/__tests__/cmds/changelogs/single.test.ts +++ b/__tests__/cmds/changelogs/single.test.ts @@ -28,12 +28,14 @@ describe('rdme changelogs (single)', () => { it('should prompt for login if no API key provided', async () => { const consoleInfoSpy = vi.spyOn(console, 'info').mockImplementation(() => {}); prompts.inject(['this-is-not-an-email', 'password', 'subdomain']); + // @ts-expect-error deliberately passing in bad data await expect(changelogs.run({})).rejects.toStrictEqual(new Error('You must provide a valid email address.')); consoleInfoSpy.mockRestore(); }); it('should error in CI if no API key provided', async () => { process.env.TEST_RDME_CI = 'true'; + // @ts-expect-error deliberately passing in bad data await expect(changelogs.run({})).rejects.toStrictEqual( new Error('No project API key provided. Please use `--key`.'), ); diff --git a/__tests__/cmds/custompages/index.test.ts b/__tests__/cmds/custompages/index.test.ts index caafab5e1..45c874fef 100644 --- a/__tests__/cmds/custompages/index.test.ts +++ b/__tests__/cmds/custompages/index.test.ts @@ -28,12 +28,14 @@ describe('rdme custompages', () => { it('should prompt for login if no API key provided', async () => { const consoleInfoSpy = vi.spyOn(console, 'info').mockImplementation(() => {}); prompts.inject(['this-is-not-an-email', 'password', 'subdomain']); + // @ts-expect-error deliberately passing in bad data await expect(custompages.run({})).rejects.toStrictEqual(new Error('You must provide a valid email address.')); consoleInfoSpy.mockRestore(); }); it('should error in CI if no API key provided', async () => { process.env.TEST_RDME_CI = 'true'; + // @ts-expect-error deliberately passing in bad data await expect(custompages.run({})).rejects.toStrictEqual( new Error('No project API key provided. Please use `--key`.'), ); diff --git a/__tests__/cmds/custompages/single.test.ts b/__tests__/cmds/custompages/single.test.ts index 369ae312f..6a9db8542 100644 --- a/__tests__/cmds/custompages/single.test.ts +++ b/__tests__/cmds/custompages/single.test.ts @@ -28,12 +28,14 @@ describe('rdme custompages (single)', () => { it('should prompt for login if no API key provided', async () => { const consoleInfoSpy = vi.spyOn(console, 'info').mockImplementation(() => {}); prompts.inject(['this-is-not-an-email', 'password', 'subdomain']); + // @ts-expect-error deliberately passing in bad data await expect(custompages.run({})).rejects.toStrictEqual(new Error('You must provide a valid email address.')); consoleInfoSpy.mockRestore(); }); it('should error in CI if no API key provided', async () => { process.env.TEST_RDME_CI = 'true'; + // @ts-expect-error deliberately passing in bad data await expect(custompages.run({})).rejects.toStrictEqual( new Error('No project API key provided. Please use `--key`.'), ); diff --git a/__tests__/cmds/docs/index.test.ts b/__tests__/cmds/docs/index.test.ts index 7c1f1e8b9..29778b316 100644 --- a/__tests__/cmds/docs/index.test.ts +++ b/__tests__/cmds/docs/index.test.ts @@ -37,6 +37,7 @@ describe('rdme docs', () => { it('should prompt for login if no API key provided', async () => { const consoleInfoSpy = vi.spyOn(console, 'info').mockImplementation(() => {}); prompts.inject(['this-is-not-an-email', 'password', 'subdomain']); + // @ts-expect-error deliberately passing in bad data await expect(docs.run({})).rejects.toStrictEqual(new Error('You must provide a valid email address.')); consoleInfoSpy.mockRestore(); }); @@ -60,6 +61,7 @@ describe('rdme docs', () => { .basicAuth({ user: key }) .reply(200, [{ version }]); + // @ts-expect-error deliberately passing in bad data await expect(docs.run({})).rejects.toStrictEqual( new Error('No path provided. Usage `rdme docs [options]`.'), ); @@ -627,6 +629,7 @@ describe('rdme docs', () => { afterEach(afterGHAEnv); it('should error in CI if no API key provided', () => { + // @ts-expect-error deliberately passing in bad data return expect(docs.run({})).rejects.toStrictEqual(new Error('No project API key provided. Please use `--key`.')); }); diff --git a/__tests__/cmds/docs/prune.test.ts b/__tests__/cmds/docs/prune.test.ts index d2f190b7a..7d9a0fe99 100644 --- a/__tests__/cmds/docs/prune.test.ts +++ b/__tests__/cmds/docs/prune.test.ts @@ -26,12 +26,14 @@ describe('rdme docs:prune', () => { it('should prompt for login if no API key provided', async () => { const consoleInfoSpy = vi.spyOn(console, 'info').mockImplementation(() => {}); prompts.inject(['this-is-not-an-email', 'password', 'subdomain']); + // @ts-expect-error deliberately passing in bad data await expect(docsPrune.run({})).rejects.toStrictEqual(new Error('You must provide a valid email address.')); consoleInfoSpy.mockRestore(); }); it('should error in CI if no API key provided', async () => { process.env.TEST_RDME_CI = 'true'; + // @ts-expect-error deliberately passing in bad data await expect(docsPrune.run({})).rejects.toStrictEqual( new Error('No project API key provided. Please use `--key`.'), ); diff --git a/__tests__/cmds/docs/single.test.ts b/__tests__/cmds/docs/single.test.ts index 280f1e50f..567e2fd55 100644 --- a/__tests__/cmds/docs/single.test.ts +++ b/__tests__/cmds/docs/single.test.ts @@ -32,6 +32,7 @@ describe('rdme docs (single)', () => { it('should prompt for login if no API key provided', async () => { const consoleInfoSpy = vi.spyOn(console, 'info').mockImplementation(() => {}); prompts.inject(['this-is-not-an-email', 'password', 'subdomain']); + // @ts-expect-error deliberately passing in bad data await expect(docs.run({})).rejects.toStrictEqual(new Error('You must provide a valid email address.')); consoleInfoSpy.mockRestore(); }); @@ -354,6 +355,7 @@ describe('rdme docs (single)', () => { afterEach(afterGHAEnv); it('should error in CI if no API key provided', () => { + // @ts-expect-error deliberately passing in bad data return expect(docs.run({})).rejects.toStrictEqual(new Error('No project API key provided. Please use `--key`.')); }); diff --git a/__tests__/cmds/open.test.ts b/__tests__/cmds/open.test.ts index 2efa0aaf8..2e02d68f3 100644 --- a/__tests__/cmds/open.test.ts +++ b/__tests__/cmds/open.test.ts @@ -65,7 +65,7 @@ describe('rdme open', () => { return Promise.resolve(); } - await expect(cmd.run({ mockOpen, dash: true, key: '12345' })).resolves.toBe( + await expect(cmd.run({ mockOpen, dash: true })).resolves.toBe( `Opening ${chalk.green(dashUrl)} in your browser...`, ); mockRequest.done(); @@ -81,7 +81,7 @@ describe('rdme open', () => { return Promise.resolve(); } - return expect(cmd.run({ mockOpen, dash: true, key: '12345' })).rejects.toStrictEqual( + return expect(cmd.run({ mockOpen, dash: true })).rejects.toStrictEqual( new Error(`Please login using \`${config.cli} login\`.`), ); }); diff --git a/__tests__/cmds/openapi/index.test.ts b/__tests__/cmds/openapi/index.test.ts index 93484c2c8..cb29a0d57 100644 --- a/__tests__/cmds/openapi/index.test.ts +++ b/__tests__/cmds/openapi/index.test.ts @@ -749,6 +749,7 @@ describe('rdme openapi', () => { describe('error handling', () => { it('should prompt for login if no API key provided', () => { prompts.inject(['this-is-not-an-email', 'password', 'subdomain']); + // @ts-expect-error deliberately passing in bad data return expect(openapi.run({})).rejects.toStrictEqual(new Error('You must provide a valid email address.')); }); @@ -1300,6 +1301,7 @@ describe('rdme openapi', () => { afterEach(afterGHAEnv); it('should error in CI if no API key provided', () => { + // @ts-expect-error deliberately passing in bad data return expect(openapi.run({})).rejects.toStrictEqual( new Error('No project API key provided. Please use `--key`.'), ); diff --git a/__tests__/cmds/versions/create.test.ts b/__tests__/cmds/versions/create.test.ts index 068948b91..4e0d5a374 100644 --- a/__tests__/cmds/versions/create.test.ts +++ b/__tests__/cmds/versions/create.test.ts @@ -21,12 +21,14 @@ describe('rdme versions:create', () => { it('should prompt for login if no API key provided', async () => { const consoleInfoSpy = vi.spyOn(console, 'info').mockImplementation(() => {}); prompts.inject(['this-is-not-an-email', 'password', 'subdomain']); + // @ts-expect-error deliberately passing in bad data await expect(createVersion.run({})).rejects.toStrictEqual(new Error('You must provide a valid email address.')); consoleInfoSpy.mockRestore(); }); it('should error in CI if no API key provided', async () => { process.env.TEST_RDME_CI = 'true'; + // @ts-expect-error deliberately passing in bad data await expect(createVersion.run({})).rejects.toStrictEqual( new Error('No project API key provided. Please use `--key`.'), ); diff --git a/__tests__/cmds/versions/delete.test.ts b/__tests__/cmds/versions/delete.test.ts index 8f02da2ec..ea7f420ee 100644 --- a/__tests__/cmds/versions/delete.test.ts +++ b/__tests__/cmds/versions/delete.test.ts @@ -21,12 +21,14 @@ describe('rdme versions:delete', () => { it('should prompt for login if no API key provided', async () => { const consoleInfoSpy = vi.spyOn(console, 'info').mockImplementation(() => {}); prompts.inject(['this-is-not-an-email', 'password', 'subdomain']); + // @ts-expect-error deliberately passing in bad data await expect(deleteVersion.run({})).rejects.toStrictEqual(new Error('You must provide a valid email address.')); consoleInfoSpy.mockRestore(); }); it('should error in CI if no API key provided', async () => { process.env.TEST_RDME_CI = 'true'; + // @ts-expect-error deliberately passing in bad data await expect(deleteVersion.run({})).rejects.toStrictEqual( new Error('No project API key provided. Please use `--key`.'), ); diff --git a/__tests__/cmds/versions/index.test.ts b/__tests__/cmds/versions/index.test.ts index 8ccc9f69b..836cc1e7c 100644 --- a/__tests__/cmds/versions/index.test.ts +++ b/__tests__/cmds/versions/index.test.ts @@ -43,12 +43,14 @@ describe('rdme versions', () => { it('should prompt for login if no API key provided', async () => { const consoleInfoSpy = vi.spyOn(console, 'info').mockImplementation(() => {}); prompts.inject(['this-is-not-an-email', 'password', 'subdomain']); + // @ts-expect-error deliberately passing in bad data await expect(versions.run({})).rejects.toStrictEqual(new Error('You must provide a valid email address.')); consoleInfoSpy.mockRestore(); }); it('should error in CI if no API key provided', async () => { process.env.TEST_RDME_CI = 'true'; + // @ts-expect-error deliberately passing in bad data await expect(versions.run({})).rejects.toStrictEqual(new Error('No project API key provided. Please use `--key`.')); delete process.env.TEST_RDME_CI; }); diff --git a/__tests__/cmds/versions/update.test.ts b/__tests__/cmds/versions/update.test.ts index 652e18480..77b227c21 100644 --- a/__tests__/cmds/versions/update.test.ts +++ b/__tests__/cmds/versions/update.test.ts @@ -21,12 +21,14 @@ describe('rdme versions:update', () => { it('should prompt for login if no API key provided', async () => { const consoleInfoSpy = vi.spyOn(console, 'info').mockImplementation(() => {}); prompts.inject(['this-is-not-an-email', 'password', 'subdomain']); + // @ts-expect-error deliberately passing in bad data await expect(updateVersion.run({})).rejects.toStrictEqual(new Error('You must provide a valid email address.')); consoleInfoSpy.mockRestore(); }); it('should error in CI if no API key provided', async () => { process.env.TEST_RDME_CI = 'true'; + // @ts-expect-error deliberately passing in bad data await expect(updateVersion.run({})).rejects.toStrictEqual( new Error('No project API key provided. Please use `--key`.'), ); diff --git a/__tests__/helpers/get-api-mock.ts b/__tests__/helpers/get-api-mock.ts index d47bba1fe..be918e6d5 100644 --- a/__tests__/helpers/get-api-mock.ts +++ b/__tests__/helpers/get-api-mock.ts @@ -78,6 +78,7 @@ export function getAPIMockMSW( ) { return rest.get(`${proxy}${config.host}${path}`, (req, res, ctx) => { try { + // @ts-expect-error once we move off node-fetch, we can make these types consistent validateHeaders(req.headers, basicAuthUser, expectedReqHeaders); let responseTransformer: ResponseTransformer; if (response?.json) { diff --git a/__tests__/helpers/vitest.matchers.ts b/__tests__/helpers/vitest.matchers.ts index f7d9c59aa..c4883c226 100644 --- a/__tests__/helpers/vitest.matchers.ts +++ b/__tests__/helpers/vitest.matchers.ts @@ -47,6 +47,7 @@ function toBeValidSchema( /** The JSON schema file */ schema: AnySchema, ): ExpectationResult { + // @ts-expect-error this still works, not sure why TS is flagging it const ajv = new Ajv({ strictTypes: false, strictTuples: false }); const data = jsYaml.load(yaml); @@ -58,6 +59,7 @@ function toBeValidSchema( let output = 'expected YAML to be valid'; if (validate.errors) + // @ts-expect-error this still works, not sure why TS is flagging it output = `${output}, here's the validation error\n\n${betterAjvErrors(schema, data, validate.errors)}`; return { diff --git a/__tests__/tsconfig.json b/__tests__/tsconfig.json index fdc5e4cbe..7fa1c84f1 100644 --- a/__tests__/tsconfig.json +++ b/__tests__/tsconfig.json @@ -1,4 +1,9 @@ { "extends": "../tsconfig.json", + "compilerOptions": { + "noEmit": true, + "skipLibCheck": true, + "strict": false + }, "include": ["*.ts", "**/*"] }