From e4e8634570a354adfb244c5b9af39504c87273b8 Mon Sep 17 00:00:00 2001 From: mrazauskas <72159681+mrazauskas@users.noreply.github.com> Date: Tue, 4 Jan 2022 10:13:14 +0200 Subject: [PATCH 01/19] feat!: use `tsd-lite` --- e2e/__fixtures__/docblock/concat.d.ts | 7 - e2e/__fixtures__/docblock/concat.js | 1 - e2e/__fixtures__/docblock/concat.test.ts | 9 - .../{failing => js-failing}/index.d.ts | 0 .../{failing => js-failing}/index.test.ts | 2 +- .../{docblock => js-failing}/package.json | 0 .../{passing => js-passing}/index.d.ts | 0 .../{passing => js-passing}/index.test.ts | 2 +- .../{failing => js-passing}/package.json | 0 e2e/__fixtures__/pkg-types/types.d.ts | 7 - e2e/__fixtures__/pkg-types/types.test.ts | 5 - e2e/__fixtures__/ts-failing/index.test.ts | 8 + e2e/__fixtures__/ts-failing/index.ts | 13 + .../{passing => ts-failing}/package.json | 0 e2e/__fixtures__/ts-passing/index.test.ts | 12 + .../{pkg-types => ts-passing}/package.json | 1 - e2e/__snapshots__/docblock.test.ts.snap | 12 - e2e/__snapshots__/failing.test.ts.snap | 24 +- e2e/__snapshots__/passing.test.ts.snap | 15 +- e2e/__snapshots__/pkg-types.test.ts.snap | 12 - e2e/docblock.test.ts | 6 - e2e/failing.test.ts | 8 +- e2e/passing.test.ts | 8 +- e2e/pkg-types.test.ts | 6 - e2e/tsconfig.json | 11 + package.json | 8 +- src/formatErrorMessage.js | 10 +- src/run.js | 49 +- yarn.lock | 983 +----------------- 29 files changed, 140 insertions(+), 1079 deletions(-) delete mode 100644 e2e/__fixtures__/docblock/concat.d.ts delete mode 100644 e2e/__fixtures__/docblock/concat.js delete mode 100644 e2e/__fixtures__/docblock/concat.test.ts rename e2e/__fixtures__/{failing => js-failing}/index.d.ts (100%) rename e2e/__fixtures__/{failing => js-failing}/index.test.ts (72%) rename e2e/__fixtures__/{docblock => js-failing}/package.json (100%) rename e2e/__fixtures__/{passing => js-passing}/index.d.ts (100%) rename e2e/__fixtures__/{passing => js-passing}/index.test.ts (72%) rename e2e/__fixtures__/{failing => js-passing}/package.json (100%) delete mode 100644 e2e/__fixtures__/pkg-types/types.d.ts delete mode 100644 e2e/__fixtures__/pkg-types/types.test.ts create mode 100644 e2e/__fixtures__/ts-failing/index.test.ts create mode 100644 e2e/__fixtures__/ts-failing/index.ts rename e2e/__fixtures__/{passing => ts-failing}/package.json (100%) create mode 100644 e2e/__fixtures__/ts-passing/index.test.ts rename e2e/__fixtures__/{pkg-types => ts-passing}/package.json (75%) delete mode 100644 e2e/__snapshots__/docblock.test.ts.snap delete mode 100644 e2e/__snapshots__/pkg-types.test.ts.snap delete mode 100644 e2e/docblock.test.ts delete mode 100644 e2e/pkg-types.test.ts create mode 100644 e2e/tsconfig.json diff --git a/e2e/__fixtures__/docblock/concat.d.ts b/e2e/__fixtures__/docblock/concat.d.ts deleted file mode 100644 index b91970a..0000000 --- a/e2e/__fixtures__/docblock/concat.d.ts +++ /dev/null @@ -1,7 +0,0 @@ -/* eslint-disable no-unused-vars */ -declare const concat: { - (a: string, b: string): string; - (a: number, b: number): number; -}; - -export default concat; diff --git a/e2e/__fixtures__/docblock/concat.js b/e2e/__fixtures__/docblock/concat.js deleted file mode 100644 index bf90601..0000000 --- a/e2e/__fixtures__/docblock/concat.js +++ /dev/null @@ -1 +0,0 @@ -module.exports = (a, b) => a + b; diff --git a/e2e/__fixtures__/docblock/concat.test.ts b/e2e/__fixtures__/docblock/concat.test.ts deleted file mode 100644 index 8992068..0000000 --- a/e2e/__fixtures__/docblock/concat.test.ts +++ /dev/null @@ -1,9 +0,0 @@ -/** - * @type concat.d.ts - */ - -import { expectType } from 'mlh-tsd'; -import concat from './concat'; - -expectType(concat('pre', 'fix')); -expectType(concat(1, 2)); diff --git a/e2e/__fixtures__/failing/index.d.ts b/e2e/__fixtures__/js-failing/index.d.ts similarity index 100% rename from e2e/__fixtures__/failing/index.d.ts rename to e2e/__fixtures__/js-failing/index.d.ts diff --git a/e2e/__fixtures__/failing/index.test.ts b/e2e/__fixtures__/js-failing/index.test.ts similarity index 72% rename from e2e/__fixtures__/failing/index.test.ts rename to e2e/__fixtures__/js-failing/index.test.ts index 761b16e..1441d07 100644 --- a/e2e/__fixtures__/failing/index.test.ts +++ b/e2e/__fixtures__/js-failing/index.test.ts @@ -1,4 +1,4 @@ -import { expectType } from 'mlh-tsd'; +import { expectType } from 'tsd-lite'; import concat from '.'; expectType(concat('pre', 'fix')); diff --git a/e2e/__fixtures__/docblock/package.json b/e2e/__fixtures__/js-failing/package.json similarity index 100% rename from e2e/__fixtures__/docblock/package.json rename to e2e/__fixtures__/js-failing/package.json diff --git a/e2e/__fixtures__/passing/index.d.ts b/e2e/__fixtures__/js-passing/index.d.ts similarity index 100% rename from e2e/__fixtures__/passing/index.d.ts rename to e2e/__fixtures__/js-passing/index.d.ts diff --git a/e2e/__fixtures__/passing/index.test.ts b/e2e/__fixtures__/js-passing/index.test.ts similarity index 72% rename from e2e/__fixtures__/passing/index.test.ts rename to e2e/__fixtures__/js-passing/index.test.ts index 0ac2437..0110284 100644 --- a/e2e/__fixtures__/passing/index.test.ts +++ b/e2e/__fixtures__/js-passing/index.test.ts @@ -1,4 +1,4 @@ -import { expectType } from 'mlh-tsd'; +import { expectType } from 'tsd-lite'; import concat from '.'; expectType(concat('pre', 'fix')); diff --git a/e2e/__fixtures__/failing/package.json b/e2e/__fixtures__/js-passing/package.json similarity index 100% rename from e2e/__fixtures__/failing/package.json rename to e2e/__fixtures__/js-passing/package.json diff --git a/e2e/__fixtures__/pkg-types/types.d.ts b/e2e/__fixtures__/pkg-types/types.d.ts deleted file mode 100644 index b91970a..0000000 --- a/e2e/__fixtures__/pkg-types/types.d.ts +++ /dev/null @@ -1,7 +0,0 @@ -/* eslint-disable no-unused-vars */ -declare const concat: { - (a: string, b: string): string; - (a: number, b: number): number; -}; - -export default concat; diff --git a/e2e/__fixtures__/pkg-types/types.test.ts b/e2e/__fixtures__/pkg-types/types.test.ts deleted file mode 100644 index 0ac2437..0000000 --- a/e2e/__fixtures__/pkg-types/types.test.ts +++ /dev/null @@ -1,5 +0,0 @@ -import { expectType } from 'mlh-tsd'; -import concat from '.'; - -expectType(concat('pre', 'fix')); -expectType(concat(1, 2)); diff --git a/e2e/__fixtures__/ts-failing/index.test.ts b/e2e/__fixtures__/ts-failing/index.test.ts new file mode 100644 index 0000000..082b4b2 --- /dev/null +++ b/e2e/__fixtures__/ts-failing/index.test.ts @@ -0,0 +1,8 @@ +import { expectError, expectType } from 'tsd-lite'; +import { makeDate } from '.'; + +expectType(makeDate(12345678)); +expectType(makeDate(5, 5, 5)); + +expectError(makeDate(1, 3, 6)); +expectError(makeDate(1, 3)); diff --git a/e2e/__fixtures__/ts-failing/index.ts b/e2e/__fixtures__/ts-failing/index.ts new file mode 100644 index 0000000..7995f8e --- /dev/null +++ b/e2e/__fixtures__/ts-failing/index.ts @@ -0,0 +1,13 @@ +/* eslint-disable no-unused-vars */ + +function makeDate(timestamp: number): Date; +function makeDate(m: number, d: number, y: number): Date; +function makeDate(mOrTimestamp: number, d?: number, y?: number): Date { + if (d !== undefined && y !== undefined) { + return new Date(y, mOrTimestamp, d); + } else { + return new Date(mOrTimestamp); + } +} + +export { makeDate }; diff --git a/e2e/__fixtures__/passing/package.json b/e2e/__fixtures__/ts-failing/package.json similarity index 100% rename from e2e/__fixtures__/passing/package.json rename to e2e/__fixtures__/ts-failing/package.json diff --git a/e2e/__fixtures__/ts-passing/index.test.ts b/e2e/__fixtures__/ts-passing/index.test.ts new file mode 100644 index 0000000..c4f3bcb --- /dev/null +++ b/e2e/__fixtures__/ts-passing/index.test.ts @@ -0,0 +1,12 @@ +import { expectError, expectType } from 'tsd-lite'; + +interface SomeType { + readonly prop: string; +} + +function doSomething(obj: SomeType) { + expectError((obj.prop = 'hello')); + return obj.prop; +} + +expectType(doSomething({ prop: 'val' })); diff --git a/e2e/__fixtures__/pkg-types/package.json b/e2e/__fixtures__/ts-passing/package.json similarity index 75% rename from e2e/__fixtures__/pkg-types/package.json rename to e2e/__fixtures__/ts-passing/package.json index aaf0bc7..e6592ef 100644 --- a/e2e/__fixtures__/pkg-types/package.json +++ b/e2e/__fixtures__/ts-passing/package.json @@ -1,5 +1,4 @@ { - "types": "./types.d.ts", "jest": { "runner": "../../../src/", "testMatch": ["**/*.test.ts"] diff --git a/e2e/__snapshots__/docblock.test.ts.snap b/e2e/__snapshots__/docblock.test.ts.snap deleted file mode 100644 index b5db4ae..0000000 --- a/e2e/__snapshots__/docblock.test.ts.snap +++ /dev/null @@ -1,12 +0,0 @@ -// Jest Snapshot v1, https://goo.gl/fbAQLP - -exports[`reads \`@type\` comment in docblock 1`] = ` -"PASS ./concat.test.ts - ✓ tsd typecheck -Test Suites: 1 passed, 1 total -Tests: 2 passed, 2 total -Snapshots: 0 total -Time: -Ran all test suites. -" -`; diff --git a/e2e/__snapshots__/failing.test.ts.snap b/e2e/__snapshots__/failing.test.ts.snap index fdd680d..5004295 100644 --- a/e2e/__snapshots__/failing.test.ts.snap +++ b/e2e/__snapshots__/failing.test.ts.snap @@ -1,7 +1,7 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP -exports[`works with failing test 1`] = ` -"FAIL ./index.test.ts +exports[`works with failing JS test 1`] = ` +"FAIL e2e/__fixtures__/js-failing/index.test.ts ✕ tsd typecheck ● tsd typecheck Argument of type 'number' is not assignable to parameter of type 'string'. @@ -15,3 +15,23 @@ Time: Ran all test suites. " `; + +exports[`works with failing TS test 1`] = ` +"FAIL e2e/__fixtures__/ts-failing/index.test.ts + ✕ tsd typecheck + ● tsd typecheck + Argument of type 'Date' is not assignable to parameter of type 'string'. + > 5 | expectType(makeDate(5, 5, 5)); + | ^ + at index.test.ts:5:20 + Expected an error, but found none. + > 7 | expectError(makeDate(1, 3, 6)); + | ^ + at index.test.ts:7:1 +Test Suites: 1 failed, 1 total +Tests: 2 failed, 2 passed, 4 total +Snapshots: 0 total +Time: +Ran all test suites. +" +`; diff --git a/e2e/__snapshots__/passing.test.ts.snap b/e2e/__snapshots__/passing.test.ts.snap index 4509932..9623d7f 100644 --- a/e2e/__snapshots__/passing.test.ts.snap +++ b/e2e/__snapshots__/passing.test.ts.snap @@ -1,7 +1,18 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP -exports[`works with passing test 1`] = ` -"PASS ./index.test.ts +exports[`works with passing JS test 1`] = ` +"PASS e2e/__fixtures__/js-passing/index.test.ts + ✓ tsd typecheck +Test Suites: 1 passed, 1 total +Tests: 2 passed, 2 total +Snapshots: 0 total +Time: +Ran all test suites. +" +`; + +exports[`works with passing TS test 1`] = ` +"PASS e2e/__fixtures__/ts-passing/index.test.ts ✓ tsd typecheck Test Suites: 1 passed, 1 total Tests: 2 passed, 2 total diff --git a/e2e/__snapshots__/pkg-types.test.ts.snap b/e2e/__snapshots__/pkg-types.test.ts.snap deleted file mode 100644 index 2b861ea..0000000 --- a/e2e/__snapshots__/pkg-types.test.ts.snap +++ /dev/null @@ -1,12 +0,0 @@ -// Jest Snapshot v1, https://goo.gl/fbAQLP - -exports[`reads \`types\` property in package.json 1`] = ` -"PASS ./types.test.ts - ✓ tsd typecheck -Test Suites: 1 passed, 1 total -Tests: 2 passed, 2 total -Snapshots: 0 total -Time: -Ran all test suites. -" -`; diff --git a/e2e/docblock.test.ts b/e2e/docblock.test.ts deleted file mode 100644 index 013ecc8..0000000 --- a/e2e/docblock.test.ts +++ /dev/null @@ -1,6 +0,0 @@ -import { expect, test } from '@jest/globals'; -import runJest from './runJest'; - -test('reads `@type` comment in docblock', async () => { - expect(await runJest('docblock')).toMatchSnapshot(); -}); diff --git a/e2e/failing.test.ts b/e2e/failing.test.ts index 0bfec06..e3eb3b2 100644 --- a/e2e/failing.test.ts +++ b/e2e/failing.test.ts @@ -1,6 +1,10 @@ import { expect, test } from '@jest/globals'; import runJest from './runJest'; -test('works with failing test', async () => { - expect(await runJest('failing')).toMatchSnapshot(); +test('works with failing JS test', async () => { + expect(await runJest('js-failing')).toMatchSnapshot(); +}); + +test('works with failing TS test', async () => { + expect(await runJest('ts-failing')).toMatchSnapshot(); }); diff --git a/e2e/passing.test.ts b/e2e/passing.test.ts index 75d2cf3..fb2ffaf 100644 --- a/e2e/passing.test.ts +++ b/e2e/passing.test.ts @@ -1,6 +1,10 @@ import { expect, test } from '@jest/globals'; import runJest from './runJest'; -test('works with passing test', async () => { - expect(await runJest('passing')).toMatchSnapshot(); +test('works with passing JS test', async () => { + expect(await runJest('js-passing')).toMatchSnapshot(); +}); + +test('works with passing TS test', async () => { + expect(await runJest('ts-passing')).toMatchSnapshot(); }); diff --git a/e2e/pkg-types.test.ts b/e2e/pkg-types.test.ts deleted file mode 100644 index b07f1e2..0000000 --- a/e2e/pkg-types.test.ts +++ /dev/null @@ -1,6 +0,0 @@ -import { expect, test } from '@jest/globals'; -import runJest from './runJest'; - -test('reads `types` property in package.json', async () => { - expect(await runJest('pkg-types')).toMatchSnapshot(); -}); diff --git a/e2e/tsconfig.json b/e2e/tsconfig.json new file mode 100644 index 0000000..9b58808 --- /dev/null +++ b/e2e/tsconfig.json @@ -0,0 +1,11 @@ +{ + "compilerOptions": { + "target": "es6", + "module": "commonjs", + "moduleResolution": "node", + "strict": true, + "noImplicitOverride": true, + "skipLibCheck": true + }, + "include": ["**/*"] +} diff --git a/package.json b/package.json index 29b1f2e..d35b4e0 100644 --- a/package.json +++ b/package.json @@ -20,14 +20,13 @@ "@babel/code-frame": "^7.15.8", "chalk": "^4.1.2", "create-jest-runner": "^0.9.0", - "graceful-fs": "^4.2.8", - "jest-docblock": "^27.0.6", - "mlh-tsd": "^0.14.1" + "tsd-lite": "^0.1.0" }, "devDependencies": { "@babel/core": "^7.15.8", "@babel/preset-env": "^7.15.8", "@babel/preset-typescript": "^7.15.0", + "@tsd/typescript": "^4.4.4", "@typescript-eslint/eslint-plugin": "^4.33.0", "@typescript-eslint/parser": "^4.33.0", "babel-jest": "^27.2.5", @@ -39,6 +38,9 @@ "prettier": "^2.4.1", "typescript": "^4.4.4" }, + "peerDependencies": { + "@tsd/typescript": "^3.8.3 || ^4.0.7" + }, "prettier": { "arrowParens": "avoid", "singleQuote": true diff --git a/src/formatErrorMessage.js b/src/formatErrorMessage.js index fb54012..1b6c6ad 100644 --- a/src/formatErrorMessage.js +++ b/src/formatErrorMessage.js @@ -18,24 +18,24 @@ const NOT_EMPTY_LINE_REGEXP = /^(?!$)/gm; const indentAllLines = (lines, indent) => lines.replace(NOT_EMPTY_LINE_REGEXP, indent); -module.exports = (diagnostics, fileContents) => { +module.exports = diagnostics => { const title = chalk.bold.red(TITLE_INDENT + BULLET + 'tsd typecheck') + '\n'; const messages = []; diagnostics.forEach(error => { - const { column, fileName, line, message } = error; + const { column, fileName, fileText, line, message } = error; const codeFrame = codeFrameColumns( - fileContents, - { start: { column: column + 1, line } }, + fileText, + { start: { column, line } }, { highlightCode: true, linesAbove: 0, linesBelow: 0 } ); const location = chalk.dim('at ') + chalk.cyan(basename(fileName)) + - chalk.dim(':' + line + ':' + (column + 1)); + chalk.dim(':' + line + ':' + column); messages.push( indentAllLines(message, MESSAGE_INDENT) + diff --git a/src/run.js b/src/run.js index 957047c..11ac395 100644 --- a/src/run.js +++ b/src/run.js @@ -1,62 +1,27 @@ -const { dirname, join, posix, relative, sep } = require('path'); -const { readFileSync } = require('graceful-fs'); -const { parse } = require('jest-docblock'); -const tsd = require('mlh-tsd'); +const tsdLite = require('tsd-lite'); const formatErrorMessage = require('./formatErrorMessage'); const { pass } = require('./pass'); const { fail } = require('./fail'); const TEST_TITLE = 'tsd typecheck'; -/** - * @param {string} testFile - * @param {string} fileContents - */ -function resolveTypingsFile(testFile, fileContents) { - let { type } = parse(fileContents); - - if (Array.isArray(type)) { - type = type[0]; - } - - if (type !== undefined) { - return join(dirname(testFile), type); - } - - return undefined; -} - -/** - * @param {string} input - */ -const normalizeSlashes = input => input.split(sep).join(posix.sep); - -module.exports = async ({ config: { rootDir }, testPath }) => { - const testFileContents = readFileSync(testPath, 'utf8'); - - const testFile = relative(rootDir, testPath); - const typingsFile = resolveTypingsFile(testFile, testFileContents); - +module.exports = async ({ testPath }) => { const start = Date.now(); - const { diagnostics, numTests } = await tsd.default({ - cwd: rootDir, - testFiles: [normalizeSlashes(testFile)], - typingsFile, - }); + const { assertionCount, diagnostics } = tsdLite.default(testPath); const end = Date.now(); const numFailed = diagnostics.length; - const numPassed = numTests - numFailed; + const numPassed = assertionCount - numFailed; if (diagnostics.length > 0) { - const errorMessage = formatErrorMessage(diagnostics, testFileContents); + const errorMessage = formatErrorMessage(diagnostics); return fail({ start, end, - test: { path: testFile, title: TEST_TITLE }, + test: { path: testPath, title: TEST_TITLE }, numFailed, numPassed, errorMessage, @@ -67,6 +32,6 @@ module.exports = async ({ config: { rootDir }, testPath }) => { start, end, numPassed, - test: { path: testFile, title: TEST_TITLE }, + test: { path: testPath, title: TEST_TITLE }, }); }; diff --git a/yarn.lock b/yarn.lock index 7b3750c..8f78a26 100644 --- a/yarn.lock +++ b/yarn.lock @@ -14,7 +14,7 @@ __metadata: languageName: node linkType: hard -"@babel/code-frame@npm:^7.0.0, @babel/code-frame@npm:^7.12.13, @babel/code-frame@npm:^7.15.8, @babel/code-frame@npm:^7.16.0": +"@babel/code-frame@npm:^7.12.13, @babel/code-frame@npm:^7.15.8, @babel/code-frame@npm:^7.16.0": version: 7.16.0 resolution: "@babel/code-frame@npm:7.16.0" dependencies: @@ -1602,13 +1602,6 @@ __metadata: languageName: node linkType: hard -"@sindresorhus/is@npm:^0.14.0": - version: 0.14.0 - resolution: "@sindresorhus/is@npm:0.14.0" - checksum: da26389d6e23f64726224ffda6f6a04bab88e15b9c4eb8f9e5fdafc3baaaa071c85c47816723b7e61e14bf2f4dcff25d6bc1629032c2916ffb8b3fe759ad7b1f - languageName: node - linkType: hard - "@sinonjs/commons@npm:^1.7.0": version: 1.8.3 resolution: "@sinonjs/commons@npm:1.8.3" @@ -1627,15 +1620,6 @@ __metadata: languageName: node linkType: hard -"@szmarczak/http-timer@npm:^1.1.2": - version: 1.1.2 - resolution: "@szmarczak/http-timer@npm:1.1.2" - dependencies: - defer-to-connect: ^1.0.1 - checksum: a46ec854231194dd1ab924a5ea0d8f0afa2b7133754a3def099cc5749e34802d8668a7d7ee3583327048354b9dc621113843d8546387e06ff57e6763cbb558d9 - languageName: node - linkType: hard - "@tootallnate/once@npm:1": version: 1.1.2 resolution: "@tootallnate/once@npm:1.1.2" @@ -1643,6 +1627,16 @@ __metadata: languageName: node linkType: hard +"@tsd/typescript@npm:4.4.4": + version: 4.4.4 + resolution: "@tsd/typescript@npm:4.4.4" + bin: + tsc: typescript/bin/tsc + tsserver: typescript/bin/tsserver + checksum: 3f1d69f12917f1e685b4cc15eba18b4d000e076092aff27228d6d47a631d2267c431914cf1061d2d5d052112d5a74071830a568e0a396a0aa6e608fb30b016f0 + languageName: node + linkType: hard + "@types/babel__core@npm:^7.0.0, @types/babel__core@npm:^7.1.14": version: 7.1.16 resolution: "@types/babel__core@npm:7.1.16" @@ -1684,23 +1678,6 @@ __metadata: languageName: node linkType: hard -"@types/eslint@npm:^7.2.13": - version: 7.28.2 - resolution: "@types/eslint@npm:7.28.2" - dependencies: - "@types/estree": "*" - "@types/json-schema": "*" - checksum: e4eeeb12e68b283bc2a7a19a344fb0770dc634b278d4f10c2d35c8261376f11ea38bd80f56929e4381cd1c11fc953437b9aabab2b93139d5b5e5f5d1455bd033 - languageName: node - linkType: hard - -"@types/estree@npm:*": - version: 0.0.50 - resolution: "@types/estree@npm:0.0.50" - checksum: dd52d035077d4ea92ff7a1191b1b02ccd0dba76ad51d1d95e4cd81dd3cc234042b859ae9160c3059dcc5c384cd895cd860d4f18913f1033736f867543f5d4743 - languageName: node - linkType: hard - "@types/graceful-fs@npm:^4.1.2": version: 4.1.5 resolution: "@types/graceful-fs@npm:4.1.5" @@ -1735,29 +1712,13 @@ __metadata: languageName: node linkType: hard -"@types/json-schema@npm:*, @types/json-schema@npm:^7.0.7": +"@types/json-schema@npm:^7.0.7": version: 7.0.9 resolution: "@types/json-schema@npm:7.0.9" checksum: 3252f0faa7aada7ad27c59bb64ff7bee0c9ad0fb7c21a3b7d255f56c732b94fe94a876f5a5f6fee27a41feac09efac082fad54314c3ce542db02445d7a6059f8 languageName: node linkType: hard -"@types/keyv@npm:^3.1.1": - version: 3.1.3 - resolution: "@types/keyv@npm:3.1.3" - dependencies: - "@types/node": "*" - checksum: dc64162bd087f54b0ed453aacde9599de10a3e19c114c452e172afd8fc784f878ca8a13addda8ef2bdfbc7964b7ae5c33c43b1ca287783e4f397fb1bc8c06801 - languageName: node - linkType: hard - -"@types/minimist@npm:^1.2.0": - version: 1.2.2 - resolution: "@types/minimist@npm:1.2.2" - checksum: 8dd59cefa7be641b961ccfe65f6ff16aaa6735412f47d5c993543d4e92590465a0d728abc0dad36e4957d105a44357379adadbca4baaa2926427d4eb66d74d0d - languageName: node - linkType: hard - "@types/node@npm:*": version: 16.11.7 resolution: "@types/node@npm:16.11.7" @@ -1765,13 +1726,6 @@ __metadata: languageName: node linkType: hard -"@types/normalize-package-data@npm:^2.4.0": - version: 2.4.1 - resolution: "@types/normalize-package-data@npm:2.4.1" - checksum: d7bb5756003a5dbf3ea1ee24ee336c036f3670a7f1ca2c8c840b5ba8fdf4b7063f8d8df16ec0427f622cc97e1c44710f089720d7caa521a5f4ec6f4073c69261 - languageName: node - linkType: hard - "@types/prettier@npm:^2.1.5": version: 2.4.2 resolution: "@types/prettier@npm:2.4.2" @@ -1779,15 +1733,6 @@ __metadata: languageName: node linkType: hard -"@types/responselike@npm:^1.0.0": - version: 1.0.0 - resolution: "@types/responselike@npm:1.0.0" - dependencies: - "@types/node": "*" - checksum: e6e6613c800aeda63e2331e753e8d21df1a2c9aa7a4bc71ed792a848e4811fc96e609759089355314a2318c76eff1f161499cd242044838ab1e6f56e463ebb9c - languageName: node - linkType: hard - "@types/stack-utils@npm:^2.0.0": version: 2.0.1 resolution: "@types/stack-utils@npm:2.0.1" @@ -2023,15 +1968,6 @@ __metadata: languageName: node linkType: hard -"ansi-align@npm:^3.0.0": - version: 3.0.1 - resolution: "ansi-align@npm:3.0.1" - dependencies: - string-width: ^4.1.0 - checksum: 46bdba3b317b0ffb76f0c607d58492c6550cb7dd9ec8afc65dc7f2481be7894b50a5211dabb175e181adb9b9cfa52d269a6ff26ecb25b48d424f48b078946ede - languageName: node - linkType: hard - "ansi-colors@npm:^4.1.1": version: 4.1.1 resolution: "ansi-colors@npm:4.1.1" @@ -2130,13 +2066,6 @@ __metadata: languageName: node linkType: hard -"arrify@npm:^1.0.1": - version: 1.0.1 - resolution: "arrify@npm:1.0.1" - checksum: f1d3bae819f49f51a09da5f5c5ce282e79ca69bbdb32db1d9f6c62b151ef801b74398d007cfe89686e2c5aeb62576a398b9068e5172b7f4e20157aa3284076d3 - languageName: node - linkType: hard - "astral-regex@npm:^2.0.0": version: 2.0.0 resolution: "astral-regex@npm:2.0.0" @@ -2280,22 +2209,6 @@ __metadata: languageName: node linkType: hard -"boxen@npm:^4.2.0": - version: 4.2.0 - resolution: "boxen@npm:4.2.0" - dependencies: - ansi-align: ^3.0.0 - camelcase: ^5.3.1 - chalk: ^3.0.0 - cli-boxes: ^2.2.0 - string-width: ^4.1.0 - term-size: ^2.1.0 - type-fest: ^0.8.1 - widest-line: ^3.1.0 - checksum: 667b291d227a86134aaacd6f2f997828607a8e2ead0da7b2568372728382765634df46e211f73d3b11a43784db7ec53da627a57213adbd42ce10ad39609ee4e3 - languageName: node - linkType: hard - "brace-expansion@npm:^1.1.7": version: 1.1.11 resolution: "brace-expansion@npm:1.1.11" @@ -2379,21 +2292,6 @@ __metadata: languageName: node linkType: hard -"cacheable-request@npm:^6.0.0": - version: 6.1.0 - resolution: "cacheable-request@npm:6.1.0" - dependencies: - clone-response: ^1.0.2 - get-stream: ^5.1.0 - http-cache-semantics: ^4.0.0 - keyv: ^3.0.0 - lowercase-keys: ^2.0.0 - normalize-url: ^4.1.0 - responselike: ^1.0.2 - checksum: 8b43f661371084ee67309c6bac93313360f55d5dfb1b622d32750c95a5f9c470a83d5798a042a67badcc0674ce0ca586a72f41e450275e78d87da1b705b91efb - languageName: node - linkType: hard - "call-bind@npm:^1.0.0": version: 1.0.2 resolution: "call-bind@npm:1.0.2" @@ -2411,18 +2309,7 @@ __metadata: languageName: node linkType: hard -"camelcase-keys@npm:^6.2.2": - version: 6.2.2 - resolution: "camelcase-keys@npm:6.2.2" - dependencies: - camelcase: ^5.3.1 - map-obj: ^4.0.0 - quick-lru: ^4.0.1 - checksum: d4bd5fa5249127be0f5b1aa961da3a9de7d0a578d9524c5013f21c0ed345637eaa1e42bab28a75bbfc8511911ffb30fec4191a9efcec52741c1a3402dc38dd53 - languageName: node - linkType: hard - -"camelcase@npm:^5.0.0, camelcase@npm:^5.3.1": +"camelcase@npm:^5.3.1": version: 5.3.1 resolution: "camelcase@npm:5.3.1" checksum: 6a3350c4ea8ab6e5109e0b443cfaf43dc40abfad7b2d79dcafbbafbe9b6b4059b4365b17ad822e24cf08e6627c1ffb65a9651d05cef9fcc6f64b6a0c2f327feb @@ -2454,16 +2341,6 @@ __metadata: languageName: node linkType: hard -"chalk@npm:^3.0.0": - version: 3.0.0 - resolution: "chalk@npm:3.0.0" - dependencies: - ansi-styles: ^4.1.0 - supports-color: ^7.1.0 - checksum: 4018b0c812880da595d0d7b8159939527b72f58d3370e2fdc1a24d9abd460bab851695d7eca014082f110d5702d1221b05493fec430ccce375de907d50cc48c1 - languageName: node - linkType: hard - "chalk@npm:^4.0.0, chalk@npm:^4.1.0, chalk@npm:^4.1.2": version: 4.1.2 resolution: "chalk@npm:4.1.2" @@ -2488,13 +2365,6 @@ __metadata: languageName: node linkType: hard -"ci-info@npm:^2.0.0": - version: 2.0.0 - resolution: "ci-info@npm:2.0.0" - checksum: 553fe83c085fce5e19e20f85b993f24a463e6f805803837a8868607bb68b1300567868694a5dff1beca6c54926a4c0be1cc9ef0c35f810653d590bf64183f6a0 - languageName: node - linkType: hard - "ci-info@npm:^3.2.0": version: 3.2.0 resolution: "ci-info@npm:3.2.0" @@ -2516,13 +2386,6 @@ __metadata: languageName: node linkType: hard -"cli-boxes@npm:^2.2.0": - version: 2.2.1 - resolution: "cli-boxes@npm:2.2.1" - checksum: 1d39df5628a44779727cc32496fff73933f22723c0ef572c043a3fa5d9b4b88024416ff92db582076b275bdf7d7f460fc7e5fa7eb8e88d3226f08233963083a7 - languageName: node - linkType: hard - "cliui@npm:^7.0.2": version: 7.0.4 resolution: "cliui@npm:7.0.4" @@ -2534,15 +2397,6 @@ __metadata: languageName: node linkType: hard -"clone-response@npm:^1.0.2": - version: 1.0.2 - resolution: "clone-response@npm:1.0.2" - dependencies: - mimic-response: ^1.0.0 - checksum: 71832f9219f2682b0915bdbc0dd187ba8e63d16b0af5342b44f97b34afe9400a1f528a253dd2f70a8dd8b23bfa4c4e106928fcc520fa5899d769af95e4cce53c - languageName: node - linkType: hard - "co@npm:^4.6.0": version: 4.6.0 resolution: "co@npm:4.6.0" @@ -2612,20 +2466,6 @@ __metadata: languageName: node linkType: hard -"configstore@npm:^5.0.1": - version: 5.0.1 - resolution: "configstore@npm:5.0.1" - dependencies: - dot-prop: ^5.2.0 - graceful-fs: ^4.1.2 - make-dir: ^3.0.0 - unique-string: ^2.0.0 - write-file-atomic: ^3.0.0 - xdg-basedir: ^4.0.0 - checksum: 81dd877bf784af29e7bbeb14e183fef21df07d9eceb3e94601a0689accb168b55f4661c629d32f079f88ea1bff3396434beb0d022414b601e72cf89adf4167e1 - languageName: node - linkType: hard - "console-control-strings@npm:^1.0.0, console-control-strings@npm:~1.1.0": version: 1.1.0 resolution: "console-control-strings@npm:1.1.0" @@ -2694,13 +2534,6 @@ __metadata: languageName: node linkType: hard -"crypto-random-string@npm:^2.0.0": - version: 2.0.0 - resolution: "crypto-random-string@npm:2.0.0" - checksum: 7bc19f6cafe3194a434198c9414941cc36d874e1f85b6fcba573b5623f77a440c0a10a94c0d0da26d7d23d85b6fe07354e589ef1a0fe2d7b32e0bab9e70ca4c1 - languageName: node - linkType: hard - "cssom@npm:^0.4.4": version: 0.4.4 resolution: "cssom@npm:0.4.4" @@ -2747,23 +2580,6 @@ __metadata: languageName: node linkType: hard -"decamelize-keys@npm:^1.1.0": - version: 1.1.0 - resolution: "decamelize-keys@npm:1.1.0" - dependencies: - decamelize: ^1.1.0 - map-obj: ^1.0.0 - checksum: dbfe6d594810ef134f8e3b8aa1684c854187a225999a0c3871b8c32d8fda886d1832b79b952a53e9557be17a78ec0198b6c26a5a5a35d012d6b18340a4dc6356 - languageName: node - linkType: hard - -"decamelize@npm:^1.1.0, decamelize@npm:^1.2.0": - version: 1.2.0 - resolution: "decamelize@npm:1.2.0" - checksum: 8ca9d03ea8ac07920f4504e219d18edff2491bdd0a3e05a1e5ca2e9a0bf6333564231de3528b01d5e76c40a38c37bbc1e09cb5a0424714f53dd615ed78ced464 - languageName: node - linkType: hard - "decimal.js@npm:^10.2.1": version: 10.3.1 resolution: "decimal.js@npm:10.3.1" @@ -2771,15 +2587,6 @@ __metadata: languageName: node linkType: hard -"decompress-response@npm:^3.3.0": - version: 3.3.0 - resolution: "decompress-response@npm:3.3.0" - dependencies: - mimic-response: ^1.0.0 - checksum: 93b0dcc8f0c32f1d5eb656e7db54fa5554227b8bfefd242c9d28f7b9c3908052c2ab8297b4af6256759da496679ee3a806d559f22d29b7e71a25879a2c25b99b - languageName: node - linkType: hard - "dedent@npm:^0.7.0": version: 0.7.0 resolution: "dedent@npm:0.7.0" @@ -2787,13 +2594,6 @@ __metadata: languageName: node linkType: hard -"deep-extend@npm:^0.6.0": - version: 0.6.0 - resolution: "deep-extend@npm:0.6.0" - checksum: 856d7f52db152c19fc5a70439ea938461cfb9338a632496fe370050dc73d3291cd76fc6713f604a5c126612dee9cac0f6da1d4b88ba4b0caa4f7214345879b89 - languageName: node - linkType: hard - "deep-is@npm:^0.1.3, deep-is@npm:~0.1.3": version: 0.1.4 resolution: "deep-is@npm:0.1.4" @@ -2808,13 +2608,6 @@ __metadata: languageName: node linkType: hard -"defer-to-connect@npm:^1.0.1": - version: 1.1.3 - resolution: "defer-to-connect@npm:1.1.3" - checksum: d8632cafae79a077b894c17f92d668784ad83825150d31c107df4fafc39f351ecd5112e0c75e0c2886c29ea359faf299bbb73246af71607b1e5b0d1ecc496ebf - languageName: node - linkType: hard - "define-properties@npm:^1.1.3": version: 1.1.3 resolution: "define-properties@npm:1.1.3" @@ -2886,22 +2679,6 @@ __metadata: languageName: node linkType: hard -"dot-prop@npm:^5.2.0": - version: 5.3.0 - resolution: "dot-prop@npm:5.3.0" - dependencies: - is-obj: ^2.0.0 - checksum: 76e6693d8803eeff9cb920988446bf223cf1f6e5b1c0c2fe07a66906392134931a481b11e3c0bd852c5cfc97fad65258bcb4359169ad1d8d624cb3f56932be98 - languageName: node - linkType: hard - -"duplexer3@npm:^0.1.4": - version: 0.1.4 - resolution: "duplexer3@npm:0.1.4" - checksum: 2a4ae463aafdb6e3541e556785d971e83e8d2b534b4cfcb114b01ebc6af6dde5a07454835c7207c8eeb5472927db1bac1b507044413164e991906c5da807938b - languageName: node - linkType: hard - "electron-to-chromium@npm:^1.3.896": version: 1.3.896 resolution: "electron-to-chromium@npm:1.3.896" @@ -2932,15 +2709,6 @@ __metadata: languageName: node linkType: hard -"end-of-stream@npm:^1.1.0": - version: 1.4.4 - resolution: "end-of-stream@npm:1.4.4" - dependencies: - once: ^1.4.0 - checksum: 7da60e458bdb5e16c006a45e85ef3bc1e3791db5ba275b0913258ccddc8899acb9252c4ddbcce87bd1b46e2a3f97315aafb9f0c0330e8aac44defb504a9d3ccd - languageName: node - linkType: hard - "enquirer@npm:^2.3.5": version: 2.3.6 resolution: "enquirer@npm:2.3.6" @@ -2964,15 +2732,6 @@ __metadata: languageName: node linkType: hard -"error-ex@npm:^1.3.1": - version: 1.3.2 - resolution: "error-ex@npm:1.3.2" - dependencies: - is-arrayish: ^0.2.1 - checksum: 6c6c9187429ae867d145bc64c682c7c137b1f8373a406dc3b605c0d92f15b85bfcea02b461dc55ae11b10d013377e1eaf3d469d2861b2f94703c743620a9c08c - languageName: node - linkType: hard - "escalade@npm:^3.1.1": version: 3.1.1 resolution: "escalade@npm:3.1.1" @@ -2980,13 +2739,6 @@ __metadata: languageName: node linkType: hard -"escape-goat@npm:^2.0.0": - version: 2.1.1 - resolution: "escape-goat@npm:2.1.1" - checksum: 8270a80ca5449893b004ae260f41aece7db91198dcb007f3f26e68c3adde0f9a4c63df9aaa23d9a3a79b670a304a30986027770b2afd5b09be18a8ffcc8ab88d - languageName: node - linkType: hard - "escape-string-regexp@npm:^1.0.5": version: 1.0.5 resolution: "escape-string-regexp@npm:1.0.5" @@ -3038,22 +2790,6 @@ __metadata: languageName: node linkType: hard -"eslint-formatter-pretty@npm:^4.0.0": - version: 4.1.0 - resolution: "eslint-formatter-pretty@npm:4.1.0" - dependencies: - "@types/eslint": ^7.2.13 - ansi-escapes: ^4.2.1 - chalk: ^4.1.0 - eslint-rule-docs: ^1.1.5 - log-symbols: ^4.0.0 - plur: ^4.0.0 - string-width: ^4.2.0 - supports-hyperlinks: ^2.0.0 - checksum: fe764e381dff9a3b925b9a02d95b815fbd7599629223b0647ff52967ad228a053632dcece488678d2a63b2e3e1c82b1f3efd9f774e95c30021e5a890d27460fc - languageName: node - linkType: hard - "eslint-plugin-prettier@npm:^3.4.1": version: 3.4.1 resolution: "eslint-plugin-prettier@npm:3.4.1" @@ -3069,13 +2805,6 @@ __metadata: languageName: node linkType: hard -"eslint-rule-docs@npm:^1.1.5": - version: 1.1.231 - resolution: "eslint-rule-docs@npm:1.1.231" - checksum: 21095d34306fe923c43ffaaf492c6442b4c8829c4cfe8e0da7f5200e1020cec0c836b99ac4d319f58d65d191fdd2e13f14375095eb7f60566bfa153e503b43bf - languageName: node - linkType: hard - "eslint-scope@npm:^5.1.1": version: 5.1.1 resolution: "eslint-scope@npm:5.1.1" @@ -3479,24 +3208,6 @@ fsevents@^2.3.2: languageName: node linkType: hard -"get-stream@npm:^4.1.0": - version: 4.1.0 - resolution: "get-stream@npm:4.1.0" - dependencies: - pump: ^3.0.0 - checksum: f41bb3c74de09d1dbe1e9d0b6d12520875d99b7ecd32c71ee21eea26d32ca74110e2406922ca64ed8cd6f10076c5f59e4fd128f10cc292eae3b669379e5f18ed - languageName: node - linkType: hard - -"get-stream@npm:^5.1.0": - version: 5.2.0 - resolution: "get-stream@npm:5.2.0" - dependencies: - pump: ^3.0.0 - checksum: c71c5625f4573a33823371da253b4183df6bdb28cb678d03bab9b5f91626d92d6f3f5ae2404c5efdc1248fbb82204e4dae4283c7ff3cc14e505754f9f748f217 - languageName: node - linkType: hard - "get-stream@npm:^6.0.0": version: 6.0.1 resolution: "get-stream@npm:6.0.1" @@ -3527,15 +3238,6 @@ fsevents@^2.3.2: languageName: node linkType: hard -"global-dirs@npm:^2.0.1": - version: 2.1.0 - resolution: "global-dirs@npm:2.1.0" - dependencies: - ini: 1.3.7 - checksum: 32e478655226c5b64f9077c88924ba3079723fb7aabd847574bc21367369ea75d722e13aa77570e22880a51e58338bf4abfbb58f3b03de88c4784a7f94d9a25a - languageName: node - linkType: hard - "globals@npm:^11.1.0": version: 11.12.0 resolution: "globals@npm:11.12.0" @@ -3552,7 +3254,7 @@ fsevents@^2.3.2: languageName: node linkType: hard -"globby@npm:^11.0.1, globby@npm:^11.0.3": +"globby@npm:^11.0.3": version: 11.0.4 resolution: "globby@npm:11.0.4" dependencies: @@ -3566,39 +3268,13 @@ fsevents@^2.3.2: languageName: node linkType: hard -"got@npm:^9.6.0": - version: 9.6.0 - resolution: "got@npm:9.6.0" - dependencies: - "@sindresorhus/is": ^0.14.0 - "@szmarczak/http-timer": ^1.1.2 - cacheable-request: ^6.0.0 - decompress-response: ^3.3.0 - duplexer3: ^0.1.4 - get-stream: ^4.1.0 - lowercase-keys: ^1.0.1 - mimic-response: ^1.0.1 - p-cancelable: ^1.0.0 - to-readable-stream: ^1.0.0 - url-parse-lax: ^3.0.0 - checksum: 4cfb862eb7e2d023f486efbd9ad5ab199ea44f957dc72be9518bf54d832ad4281ef3b63eac4d861b189690c3b7674eef3e1cb4f41285a83fa43293431ab879bd - languageName: node - linkType: hard - -"graceful-fs@npm:^4.1.2, graceful-fs@npm:^4.2.4, graceful-fs@npm:^4.2.6, graceful-fs@npm:^4.2.8": +"graceful-fs@npm:^4.2.4, graceful-fs@npm:^4.2.6": version: 4.2.8 resolution: "graceful-fs@npm:4.2.8" checksum: b07e032c0a17e928d3e8ab0f0fea1492efd4568b55a3d2675aaaccf1619eca91156edfa0cb05e99b923e24edf5e26fdce22ffa58ec14d5b13a3b1392460f37f0 languageName: node linkType: hard -"hard-rejection@npm:^2.1.0": - version: 2.1.0 - resolution: "hard-rejection@npm:2.1.0" - checksum: 27bc09d185ca8131356f0f3391ae5965c5ed8ec9eddf697d604e33c76eb995831e60ac636e5e5839587d0499f29719171c19d0af5fa12e9e7f7c0a1689e22b6f - languageName: node - linkType: hard - "has-flag@npm:^3.0.0": version: 3.0.0 resolution: "has-flag@npm:3.0.0" @@ -3627,13 +3303,6 @@ fsevents@^2.3.2: languageName: node linkType: hard -"has-yarn@npm:^2.1.0": - version: 2.1.0 - resolution: "has-yarn@npm:2.1.0" - checksum: 105682f263a3437972c75594cdda237ce8454f67cae37a36a507701f300dade0460231dabbe873a7df035b7c0a0b3a686c9fcd1eebb29c73ca35753ecae6fb7d - languageName: node - linkType: hard - "has@npm:^1.0.3": version: 1.0.3 resolution: "has@npm:1.0.3" @@ -3643,13 +3312,6 @@ fsevents@^2.3.2: languageName: node linkType: hard -"hosted-git-info@npm:^2.1.4": - version: 2.8.9 - resolution: "hosted-git-info@npm:2.8.9" - checksum: cf4dfac9b94aa601ae889e7e3cb5a7021a8517b517f933fec0b3a8dc5002edece01475c82f70cc18a051a5a8105bcb2fbe4e64f0b8f321eb99054a49a75b5aa3 - languageName: node - linkType: hard - "html-encoding-sniffer@npm:^2.0.1": version: 2.0.1 resolution: "html-encoding-sniffer@npm:2.0.1" @@ -3666,7 +3328,7 @@ fsevents@^2.3.2: languageName: node linkType: hard -"http-cache-semantics@npm:^4.0.0, http-cache-semantics@npm:^4.1.0": +"http-cache-semantics@npm:^4.1.0": version: 4.1.0 resolution: "http-cache-semantics@npm:4.1.0" checksum: 451df9784af2acbe0cc1fd70291285c08ca4a8966ab5ee4d3975e003d1ad4d74c81473086d628f31296b31221966fda8bc5ea1e29dd8f1f33f9fc2b0fdca65ca @@ -3752,13 +3414,6 @@ fsevents@^2.3.2: languageName: node linkType: hard -"import-lazy@npm:^2.1.0": - version: 2.1.0 - resolution: "import-lazy@npm:2.1.0" - checksum: 4907a2ddbe39df77b28cbb3e0a41d675f56990b935cd579df7ccd143501f5496382cfbf8d53f359a41660d4a8963bec22a5d68e12d8fae9c828bf59664114963 - languageName: node - linkType: hard - "import-local@npm:^3.0.2": version: 3.0.3 resolution: "import-local@npm:3.0.3" @@ -3809,20 +3464,6 @@ fsevents@^2.3.2: languageName: node linkType: hard -"ini@npm:1.3.7": - version: 1.3.7 - resolution: "ini@npm:1.3.7" - checksum: cf00289cb43d8de635d907c202f7dd8650d8228c322b501c089c4f52ea78dc21ebc38b07c4f37b532f52eba110d11b71f32bc22173097ca0e9c8521575688d7c - languageName: node - linkType: hard - -"ini@npm:~1.3.0": - version: 1.3.8 - resolution: "ini@npm:1.3.8" - checksum: 62189ce7ea44c5778e757e4232c581212e838f3c39e79d931bb9152fd4b9275f09fb20b96afdd60ba9f5d7996b92486cad6cc617fcb84ff4beedd1b33b86221e - languageName: node - linkType: hard - "ip@npm:^1.1.5": version: 1.1.5 resolution: "ip@npm:1.1.5" @@ -3830,31 +3471,6 @@ fsevents@^2.3.2: languageName: node linkType: hard -"irregular-plurals@npm:^3.2.0": - version: 3.3.0 - resolution: "irregular-plurals@npm:3.3.0" - checksum: ca26e42b7e71267f80497c174ea211a6d2327d07742ab493b5450adbbd6e96d5c0e2f7c89695134eca591216bf9a2b050a3b2a66c7491716772b17d473e3456d - languageName: node - linkType: hard - -"is-arrayish@npm:^0.2.1": - version: 0.2.1 - resolution: "is-arrayish@npm:0.2.1" - checksum: fc2bbe14dbcb27b490e63b7fbf0e3b0aae843e5e1fa96d79450bb9617797615a575c78c454ffc8e027c3ad50d63d83e85a7387784979dcd46686d2eb5f412db0 - languageName: node - linkType: hard - -"is-ci@npm:^2.0.0": - version: 2.0.0 - resolution: "is-ci@npm:2.0.0" - dependencies: - ci-info: ^2.0.0 - bin: - is-ci: bin.js - checksum: 09083018edafd63221ff0506356f13c0aaf4b75a6435ea648bc67d07ddab199b2d5b9297de43d0821df1a14c18cd9f1edd1775a0166abfe37390843e79137213 - languageName: node - linkType: hard - "is-core-module@npm:^2.2.0": version: 2.8.0 resolution: "is-core-module@npm:2.8.0" @@ -3903,16 +3519,6 @@ fsevents@^2.3.2: languageName: node linkType: hard -"is-installed-globally@npm:^0.3.1": - version: 0.3.2 - resolution: "is-installed-globally@npm:0.3.2" - dependencies: - global-dirs: ^2.0.1 - is-path-inside: ^3.0.1 - checksum: 10fc4fb09fe86c0ed5fa21e821607c6e1ca258386787b1aaad3afbe59470d0c3b50b076cbc996173b9b4c0de7d6a8b741aabf9229ab09d6c37ff663e51631529 - languageName: node - linkType: hard - "is-lambda@npm:^1.0.1": version: 1.0.1 resolution: "is-lambda@npm:1.0.1" @@ -3920,13 +3526,6 @@ fsevents@^2.3.2: languageName: node linkType: hard -"is-npm@npm:^4.0.0": - version: 4.0.0 - resolution: "is-npm@npm:4.0.0" - checksum: 94ab2edae37293ceba039729ba1de851448059979138f72d7184a89a484bf70fbefc462268fecf59865e54ce972c15164229acc73bd56c025a7afc7dd0702c40 - languageName: node - linkType: hard - "is-number@npm:^7.0.0": version: 7.0.0 resolution: "is-number@npm:7.0.0" @@ -3934,27 +3533,6 @@ fsevents@^2.3.2: languageName: node linkType: hard -"is-obj@npm:^2.0.0": - version: 2.0.0 - resolution: "is-obj@npm:2.0.0" - checksum: ffa67ed5df66e37757876cd976380737a0430551789a0457b8c031eaedef8f5c6bc4ab6d903e529efb777545f8718ab73d9badde61c8b08720a3747ccff0b2a0 - languageName: node - linkType: hard - -"is-path-inside@npm:^3.0.1": - version: 3.0.3 - resolution: "is-path-inside@npm:3.0.3" - checksum: b19a2937441131e68b9eb9931ec8933bc87743a8f5364f6f7e1b8fc6c1403386ecf305835fb781e3986332fada456d71ff95af77ccda5806b35aac58234f9080 - languageName: node - linkType: hard - -"is-plain-obj@npm:^1.1.0": - version: 1.1.0 - resolution: "is-plain-obj@npm:1.1.0" - checksum: d2eb5a32eacd7c79f3b2fe20552d091805a5ae88a7ca2aa71226bf822e4d690ef046ed2beb795f32666a401dfbf9a25ee3d4acde5426f963d55474468708ad22 - languageName: node - linkType: hard - "is-potential-custom-element-name@npm:^1.0.1": version: 1.0.1 resolution: "is-potential-custom-element-name@npm:1.0.1" @@ -3976,20 +3554,6 @@ fsevents@^2.3.2: languageName: node linkType: hard -"is-unicode-supported@npm:^0.1.0": - version: 0.1.0 - resolution: "is-unicode-supported@npm:0.1.0" - checksum: 00ca6f5581b81d55c567d259175cb1af08c60ae95f6aad69adadfdfbe098c60ef5617ad440770d821f1710773987c0b13ed6dd375cd9ab1bd7b7dd8f9a42625c - languageName: node - linkType: hard - -"is-yarn-global@npm:^0.3.0": - version: 0.3.0 - resolution: "is-yarn-global@npm:0.3.0" - checksum: 5a66f706f24e76979ce252a8f5ff4bb680da3c3eb978a2930f0147fecaa583eefb4ee1765bcfb85c0b4e83f67a231355e158a89b0047e83649f8f11a93563ef9 - languageName: node - linkType: hard - "isarray@npm:~1.0.0": version: 1.0.0 resolution: "isarray@npm:1.0.0" @@ -4392,6 +3956,7 @@ fsevents@^2.3.2: "@babel/core": ^7.15.8 "@babel/preset-env": ^7.15.8 "@babel/preset-typescript": ^7.15.0 + "@tsd/typescript": 4.4.4 "@typescript-eslint/eslint-plugin": ^4.33.0 "@typescript-eslint/parser": ^4.33.0 babel-jest: ^27.2.5 @@ -4401,11 +3966,9 @@ fsevents@^2.3.2: eslint-config-prettier: ^8.3.0 eslint-plugin-prettier: ^3.4.1 execa: ^5.1.1 - graceful-fs: ^4.2.8 jest: ^27.2.5 - jest-docblock: ^27.0.6 - mlh-tsd: ^0.14.1 prettier: ^2.4.1 + tsd-lite: ^0.1.0 typescript: ^4.4.4 languageName: unknown linkType: soft @@ -4665,20 +4228,6 @@ fsevents@^2.3.2: languageName: node linkType: hard -"json-buffer@npm:3.0.0": - version: 3.0.0 - resolution: "json-buffer@npm:3.0.0" - checksum: 09b53ecc8ffbb1252d9ef07f37ad616eb0769325d749c87555df786dc70e9855d4ad208255bbf232c86069504756277a7efb6725a31f6e6c4ef39a7b072e75f2 - languageName: node - linkType: hard - -"json-parse-even-better-errors@npm:^2.3.0": - version: 2.3.1 - resolution: "json-parse-even-better-errors@npm:2.3.1" - checksum: d89fa7fe57957f3004cf0e786465a64183c0de861f6fda800d352956397c01b22f9feb141d0dce5b23f5dbe0aae74dd5b45fc0c3c1679b0942688efa5544e726 - languageName: node - linkType: hard - "json-schema-traverse@npm:^0.4.1": version: 0.4.1 resolution: "json-schema-traverse@npm:0.4.1" @@ -4711,22 +4260,6 @@ fsevents@^2.3.2: languageName: node linkType: hard -"keyv@npm:^3.0.0": - version: 3.1.0 - resolution: "keyv@npm:3.1.0" - dependencies: - json-buffer: 3.0.0 - checksum: 6bf032ee504f27e00ae3a366c7e0ca5d93b8f947672871568f2a1456bf56d1bc4e55555158a45188d14483c4c38d0fa1dc7f0585b0d6c640f8e79abc9b4d3162 - languageName: node - linkType: hard - -"kind-of@npm:^6.0.3": - version: 6.0.3 - resolution: "kind-of@npm:6.0.3" - checksum: 5de5d6577796af87a983199d6350ed41c670abec4a306cc43ca887c1afdbd6b89af9ab00016e3ca17eb7ad89ebfd9bb817d33baa89f855c6c95398a8b8abbf08 - languageName: node - linkType: hard - "kleur@npm:^3.0.3": version: 3.0.3 resolution: "kleur@npm:3.0.3" @@ -4734,15 +4267,6 @@ fsevents@^2.3.2: languageName: node linkType: hard -"latest-version@npm:^5.0.0": - version: 5.1.0 - resolution: "latest-version@npm:5.1.0" - dependencies: - package-json: ^6.3.0 - checksum: 63c1f224358d094a75782cc48a5b3eeaf70a70c0e18f8b814480e50ed0ecedb4bc5f2c9cc44c7983fbf31e865f0376526bf9a563c304f3261971f38d8f51c5c6 - languageName: node - linkType: hard - "leven@npm:^3.1.0": version: 3.1.0 resolution: "leven@npm:3.1.0" @@ -4770,13 +4294,6 @@ fsevents@^2.3.2: languageName: node linkType: hard -"lines-and-columns@npm:^1.1.6": - version: 1.1.6 - resolution: "lines-and-columns@npm:1.1.6" - checksum: 798b80ed7ae3fba34d43fe29591ccb4f16f6fca1da4e1f9922b92264b91d931012433c248daf8e44caa74feb40c0eaa0f27a14f8ee68b6ffb425f3c3f785af27 - languageName: node - linkType: hard - "locate-path@npm:^5.0.0": version: 5.0.0 resolution: "locate-path@npm:5.0.0" @@ -4814,30 +4331,6 @@ fsevents@^2.3.2: languageName: node linkType: hard -"log-symbols@npm:^4.0.0": - version: 4.1.0 - resolution: "log-symbols@npm:4.1.0" - dependencies: - chalk: ^4.1.0 - is-unicode-supported: ^0.1.0 - checksum: 57be4aeb6a6ecb81d8267600836f81928da1d846ad13384a9a22d179e27590fdb680946edbd15642a31735183adaa3dc6aae2d20e619a19fa0d54e1aee945915 - languageName: node - linkType: hard - -"lowercase-keys@npm:^1.0.0, lowercase-keys@npm:^1.0.1": - version: 1.0.1 - resolution: "lowercase-keys@npm:1.0.1" - checksum: ac9d79c47dd9f831cebb2cbe930e72f7c03b27ab07c5bb9072ee0b4a853ce26d6648403b9eb371b3d400af3790da9ce65cf7207af887f8c134d53dce81559107 - languageName: node - linkType: hard - -"lowercase-keys@npm:^2.0.0": - version: 2.0.0 - resolution: "lowercase-keys@npm:2.0.0" - checksum: 4da67f41865a25360bb05749a66a83c60987c7efa0b8ec443941a19978c21ba916ae9fedca25b96fc652026c4264a437d3fec099d1949716b5483eec42395ec9 - languageName: node - linkType: hard - "lru-cache@npm:^6.0.0": version: 6.0.0 resolution: "lru-cache@npm:6.0.0" @@ -4889,39 +4382,6 @@ fsevents@^2.3.2: languageName: node linkType: hard -"map-obj@npm:^1.0.0": - version: 1.0.1 - resolution: "map-obj@npm:1.0.1" - checksum: e68b20e4fa76efdbba9a7af05b879eb7a6c5ccb7a9d813796de825da4c182fc3dab66f4b2a32a9aefae83db152a0172deb1e19a9c2322c6d412b8f9f81ca51a4 - languageName: node - linkType: hard - -"map-obj@npm:^4.0.0": - version: 4.3.0 - resolution: "map-obj@npm:4.3.0" - checksum: 5964bd3e98860e6c4974ca5f6c94916c43e27d3ba28a6189ba5b65a92a56a59d8fd5e228c19489dacbb0bbdf3089fa846d70a888edd8af28ada7b65698c82264 - languageName: node - linkType: hard - -"meow@npm:^7.0.1": - version: 7.1.1 - resolution: "meow@npm:7.1.1" - dependencies: - "@types/minimist": ^1.2.0 - camelcase-keys: ^6.2.2 - decamelize-keys: ^1.1.0 - hard-rejection: ^2.1.0 - minimist-options: 4.1.0 - normalize-package-data: ^2.5.0 - read-pkg-up: ^7.0.1 - redent: ^3.0.0 - trim-newlines: ^3.0.0 - type-fest: ^0.13.1 - yargs-parser: ^18.1.3 - checksum: de6d2f15332a18da5e13bb3f935f9718cf7ae697d121009adee7a3410bfc63f6b7896476bb0e1ef101faacea4d4a4dc95108e3c9eab0e336b990a115646b72e8 - languageName: node - linkType: hard - "merge-stream@npm:^2.0.0": version: 2.0.0 resolution: "merge-stream@npm:2.0.0" @@ -4969,20 +4429,6 @@ fsevents@^2.3.2: languageName: node linkType: hard -"mimic-response@npm:^1.0.0, mimic-response@npm:^1.0.1": - version: 1.0.1 - resolution: "mimic-response@npm:1.0.1" - checksum: 64b43c717ed8710bc920576e96d38d0e504e9eec3114af8e00c9e3d7ae53cd459ee38febb0badc83e3a4e6d21cd571db43e9011f8cf014809989c87a1a9f0ea4 - languageName: node - linkType: hard - -"min-indent@npm:^1.0.0": - version: 1.0.1 - resolution: "min-indent@npm:1.0.1" - checksum: c3aeea46bc432e6ce69b86717e98fbb544e338abb5e3c93cfa196c427e3d5a4a6ee4f76e6931a9e424fb53e83451b90fc417ce7db04440a92d68369704ad11d1 - languageName: node - linkType: hard - "minimatch@npm:^3.0.4": version: 3.0.4 resolution: "minimatch@npm:3.0.4" @@ -4992,18 +4438,7 @@ fsevents@^2.3.2: languageName: node linkType: hard -"minimist-options@npm:4.1.0": - version: 4.1.0 - resolution: "minimist-options@npm:4.1.0" - dependencies: - arrify: ^1.0.1 - is-plain-obj: ^1.1.0 - kind-of: ^6.0.3 - checksum: 51f1aba56f9c2c2986d85c98a29abec26c632019abd2966a151029cf2cf0903d81894781460e0d5755d4f899bb3884bc86fc9af36ab31469a38d82cf74f4f651 - languageName: node - linkType: hard - -"minimist@npm:^1.2.0, minimist@npm:^1.2.5": +"minimist@npm:^1.2.5": version: 1.2.5 resolution: "minimist@npm:1.2.5" checksum: b77b8590147a4e217ff34266236bc39de23b52e6e33054076991ff674c7397a1380a7bde11111916f16f003a94aaa7e4f3d92595a32189644ff607fabc65a5b6 @@ -5089,22 +4524,6 @@ fsevents@^2.3.2: languageName: node linkType: hard -"mlh-tsd@npm:^0.14.1": - version: 0.14.1 - resolution: "mlh-tsd@npm:0.14.1" - dependencies: - eslint-formatter-pretty: ^4.0.0 - globby: ^11.0.1 - meow: ^7.0.1 - path-exists: ^4.0.0 - read-pkg-up: ^7.0.0 - update-notifier: ^4.1.0 - bin: - mlh-tsd: dist/cli.js - checksum: c9538dbe479bb770346e74789ec3681b07b8f7311a1bc8f4d1f2e527270ef66c41c490fa0f90f1594672a00c6f229d9d5a0b753af596da708d20a7b8defc130c - languageName: node - linkType: hard - "ms@npm:2.1.2": version: 2.1.2 resolution: "ms@npm:2.1.2" @@ -5185,18 +4604,6 @@ fsevents@^2.3.2: languageName: node linkType: hard -"normalize-package-data@npm:^2.5.0": - version: 2.5.0 - resolution: "normalize-package-data@npm:2.5.0" - dependencies: - hosted-git-info: ^2.1.4 - resolve: ^1.10.0 - semver: 2 || 3 || 4 || 5 - validate-npm-package-license: ^3.0.1 - checksum: 97d4d6b061cab51425ddb05c38d126d7a1a2a6f2c9949bef2b5ad7ef19c005df12099ea442e4cb09190929b7770008f94f87b10342a66f739acf92a7ebb9d9f2 - languageName: node - linkType: hard - "normalize-path@npm:^3.0.0": version: 3.0.0 resolution: "normalize-path@npm:3.0.0" @@ -5204,13 +4611,6 @@ fsevents@^2.3.2: languageName: node linkType: hard -"normalize-url@npm:^4.1.0": - version: 4.5.1 - resolution: "normalize-url@npm:4.5.1" - checksum: 31dd05ad33cc649d5c1cd390f1e494d36bdcd3c0a440fd873290ffc5d4f838e2d0c1f4e9c29c9395d4907318cd8c0aaa759af336ac04ec0bd6fecb62ef1f4556 - languageName: node - linkType: hard - "npm-run-path@npm:^4.0.1": version: 4.0.1 resolution: "npm-run-path@npm:4.0.1" @@ -5272,7 +4672,7 @@ fsevents@^2.3.2: languageName: node linkType: hard -"once@npm:^1.3.0, once@npm:^1.3.1, once@npm:^1.4.0": +"once@npm:^1.3.0": version: 1.4.0 resolution: "once@npm:1.4.0" dependencies: @@ -5318,13 +4718,6 @@ fsevents@^2.3.2: languageName: node linkType: hard -"p-cancelable@npm:^1.0.0": - version: 1.1.0 - resolution: "p-cancelable@npm:1.1.0" - checksum: 01fdd9ac319f0e69e22c18d5b9e5f4dca62a0827d72349c73b0c88b07c760849de49201dcbe4fbbcbe61b4bdce8f4f3596cfbbfed664cf411ff1ab9a80664574 - languageName: node - linkType: hard - "p-limit@npm:^2.2.0": version: 2.3.0 resolution: "p-limit@npm:2.3.0" @@ -5359,18 +4752,6 @@ fsevents@^2.3.2: languageName: node linkType: hard -"package-json@npm:^6.3.0": - version: 6.5.0 - resolution: "package-json@npm:6.5.0" - dependencies: - got: ^9.6.0 - registry-auth-token: ^4.0.0 - registry-url: ^5.0.0 - semver: ^6.2.0 - checksum: 3023e318de5d76bbd650aedd3671b452cb1e018c4d99b72955dde0f22c6ba765c3f6d678ab0ee45e2561842e8399b1fea77a0730dc93c39505e7ebfed7ab2818 - languageName: node - linkType: hard - "parent-module@npm:^1.0.0": version: 1.0.1 resolution: "parent-module@npm:1.0.1" @@ -5380,18 +4761,6 @@ fsevents@^2.3.2: languageName: node linkType: hard -"parse-json@npm:^5.0.0": - version: 5.2.0 - resolution: "parse-json@npm:5.2.0" - dependencies: - "@babel/code-frame": ^7.0.0 - error-ex: ^1.3.1 - json-parse-even-better-errors: ^2.3.0 - lines-and-columns: ^1.1.6 - checksum: 65b1e494a51862340248f542666712830c7b6f4d632ca099520eeacb163275f35cbbcf72643cab1d8a71c3cdf87dcd0a7e03c685c7ac1068d24b49c915a7e884 - languageName: node - linkType: hard - "parse5@npm:6.0.1": version: 6.0.1 resolution: "parse5@npm:6.0.1" @@ -5466,15 +4835,6 @@ fsevents@^2.3.2: languageName: node linkType: hard -"plur@npm:^4.0.0": - version: 4.0.0 - resolution: "plur@npm:4.0.0" - dependencies: - irregular-plurals: ^3.2.0 - checksum: 22e3ba41be31e5843decf0b68ce555b7750da3b8ba56e34fbe3abc775fa9428ecf263ef401a5d0962cface0290caf0132ddd87617f02fc41789bbb0fa2a010c1 - languageName: node - linkType: hard - "prelude-ls@npm:^1.2.1": version: 1.2.1 resolution: "prelude-ls@npm:1.2.1" @@ -5489,13 +4849,6 @@ fsevents@^2.3.2: languageName: node linkType: hard -"prepend-http@npm:^2.0.0": - version: 2.0.0 - resolution: "prepend-http@npm:2.0.0" - checksum: d39325775adce38e18213fd19656af4abd7672ef6b1e330437079bb237de011d49a70bfb56b35037603d30ef279cceddb33794f70168582d50845c2ade29968e - languageName: node - linkType: hard - "prettier-linter-helpers@npm:^1.0.0": version: 1.0.0 resolution: "prettier-linter-helpers@npm:1.0.0" @@ -5574,16 +4927,6 @@ fsevents@^2.3.2: languageName: node linkType: hard -"pump@npm:^3.0.0": - version: 3.0.0 - resolution: "pump@npm:3.0.0" - dependencies: - end-of-stream: ^1.1.0 - once: ^1.3.1 - checksum: 5464d5cf6c6f083cc60cb45b074fb9a4a92ba4d3e0d89e9b2fa1906d8151fd3766784a426725ccf1af50d1c29963ac20b13829933549830e08a6704e3f95e08c - languageName: node - linkType: hard - "punycode@npm:^2.1.0, punycode@npm:^2.1.1": version: 2.1.1 resolution: "punycode@npm:2.1.1" @@ -5591,15 +4934,6 @@ fsevents@^2.3.2: languageName: node linkType: hard -"pupa@npm:^2.0.1": - version: 2.1.1 - resolution: "pupa@npm:2.1.1" - dependencies: - escape-goat: ^2.0.0 - checksum: b300d979e1bcc388b0aabe723e9bd7f6598f02a10e66b693b9dde6249f68ad95e93804a1511dbbafd172e404b837d60c49ebdd152e3e94909dc282ca4ba285e8 - languageName: node - linkType: hard - "queue-microtask@npm:^1.2.2": version: 1.2.3 resolution: "queue-microtask@npm:1.2.3" @@ -5607,27 +4941,6 @@ fsevents@^2.3.2: languageName: node linkType: hard -"quick-lru@npm:^4.0.1": - version: 4.0.1 - resolution: "quick-lru@npm:4.0.1" - checksum: 91847e4b07453655f73513b96a3b49e3bb8bf37de1ce2075d44e5dddb2f08050c5dc858d97884d61618bb44487945880b4b481fe93e94a3622b43036f8b94e11 - languageName: node - linkType: hard - -"rc@npm:^1.2.8": - version: 1.2.8 - resolution: "rc@npm:1.2.8" - dependencies: - deep-extend: ^0.6.0 - ini: ~1.3.0 - minimist: ^1.2.0 - strip-json-comments: ~2.0.1 - bin: - rc: ./cli.js - checksum: ea2b7f7cee201a67923a2240de594a5d9b59bd312b814b06536d3d609a416dfd6fb9b85ea2abfd3b8a4eb5ed33eaff946ee75a8f2b7fb10941073c5cfee6b7a5 - languageName: node - linkType: hard - "react-is@npm:^17.0.1": version: 17.0.2 resolution: "react-is@npm:17.0.2" @@ -5635,29 +4948,6 @@ fsevents@^2.3.2: languageName: node linkType: hard -"read-pkg-up@npm:^7.0.0, read-pkg-up@npm:^7.0.1": - version: 7.0.1 - resolution: "read-pkg-up@npm:7.0.1" - dependencies: - find-up: ^4.1.0 - read-pkg: ^5.2.0 - type-fest: ^0.8.1 - checksum: b8f97cc1f8235ce752b10b7b6423b0460411b4a6046186de8980429bbad8709537a4d6fac6e35a97c8630d19bab29d9013644cc5296be2d5043db3e40094b0cc - languageName: node - linkType: hard - -"read-pkg@npm:^5.2.0": - version: 5.2.0 - resolution: "read-pkg@npm:5.2.0" - dependencies: - "@types/normalize-package-data": ^2.4.0 - normalize-package-data: ^2.5.0 - parse-json: ^5.0.0 - type-fest: ^0.6.0 - checksum: 641102f0955f64304f97ed388bfe3b7ce55d74b1ffe1be06be1ae75479ce4910aa7177460d1982af6963f80b293a25f25d593a52a4328d941fd9b7d89fde2dbf - languageName: node - linkType: hard - "readable-stream@npm:^2.0.6": version: 2.3.7 resolution: "readable-stream@npm:2.3.7" @@ -5673,16 +4963,6 @@ fsevents@^2.3.2: languageName: node linkType: hard -"redent@npm:^3.0.0": - version: 3.0.0 - resolution: "redent@npm:3.0.0" - dependencies: - indent-string: ^4.0.0 - strip-indent: ^3.0.0 - checksum: 78c8aa0a1076f47e0e198bfc8a9aa7d4ae3163c6951bd5de1015e47661bba62ea36573337bbeb4b309b48cc71954edbe43ae4aa3163db1996a781b757c5c47d7 - languageName: node - linkType: hard - "regenerate-unicode-properties@npm:^9.0.0": version: 9.0.0 resolution: "regenerate-unicode-properties@npm:9.0.0" @@ -5736,24 +5016,6 @@ fsevents@^2.3.2: languageName: node linkType: hard -"registry-auth-token@npm:^4.0.0": - version: 4.2.1 - resolution: "registry-auth-token@npm:4.2.1" - dependencies: - rc: ^1.2.8 - checksum: 10ca9caeea81da4a9e52f1932c5aa0fc67cc7301df48a768260e946df354dfde8ccd0c2f1caa1b66b49620bb696d18eb2f4be93c55f0217439e2ab116d6c32a4 - languageName: node - linkType: hard - -"registry-url@npm:^5.0.0": - version: 5.1.0 - resolution: "registry-url@npm:5.1.0" - dependencies: - rc: ^1.2.8 - checksum: 50802a1d43efb18505ffc1f242b8af43bde95e95ac2461f453ef21d4bce793d4230076147809f1ade7452afaa537c6e0324dd4a7bc9d83f1b6f5cc7e1300c544 - languageName: node - linkType: hard - "regjsgen@npm:^0.5.2": version: 0.5.2 resolution: "regjsgen@npm:0.5.2" @@ -5816,7 +5078,7 @@ fsevents@^2.3.2: languageName: node linkType: hard -"resolve@^1.10.0, resolve@^1.14.2, resolve@^1.20.0": +"resolve@^1.14.2, resolve@^1.20.0": version: 1.20.0 resolution: "resolve@npm:1.20.0" dependencies: @@ -5826,7 +5088,7 @@ fsevents@^2.3.2: languageName: node linkType: hard -"resolve@patch:resolve@^1.10.0#builtin, resolve@patch:resolve@^1.14.2#builtin, resolve@patch:resolve@^1.20.0#builtin": +"resolve@patch:resolve@^1.14.2#builtin, resolve@patch:resolve@^1.20.0#builtin": version: 1.20.0 resolution: "resolve@patch:resolve@npm%3A1.20.0#builtin::version=1.20.0&hash=3388aa" dependencies: @@ -5836,15 +5098,6 @@ fsevents@^2.3.2: languageName: node linkType: hard -"responselike@npm:^1.0.2": - version: 1.0.2 - resolution: "responselike@npm:1.0.2" - dependencies: - lowercase-keys: ^1.0.0 - checksum: c904f1499418d0729e9592079ea653c8fd35d50a7cca1a17d58ef3137382f915cbd344daaa7fe2e2b064a6d9fab4bcdd8b2ab963c523829427b440b775fba8fd - languageName: node - linkType: hard - "retry@npm:^0.12.0": version: 0.12.0 resolution: "retry@npm:0.12.0" @@ -5902,24 +5155,6 @@ fsevents@^2.3.2: languageName: node linkType: hard -"semver-diff@npm:^3.1.1": - version: 3.1.1 - resolution: "semver-diff@npm:3.1.1" - dependencies: - semver: ^6.3.0 - checksum: d5c9b693e6118bf56226b52fe4bb51f1f05fd7b91bd7979d3d01b32d4e136e16e4ea110f28f0690608712473d682e7a71a05f0ab65b8ba4a70d63b536d4c6278 - languageName: node - linkType: hard - -"semver@npm:2 || 3 || 4 || 5": - version: 5.7.1 - resolution: "semver@npm:5.7.1" - bin: - semver: ./bin/semver - checksum: 06ff0ed753ebf741b7602be8faad620d6e160a2cb3f61019d00d919c8bca141638aa23c34da779b8595afdc9faa3678bfbb5f60366b6a4f65f98cf86605bbcdb - languageName: node - linkType: hard - "semver@npm:7.0.0": version: 7.0.0 resolution: "semver@npm:7.0.0" @@ -5929,7 +5164,7 @@ fsevents@^2.3.2: languageName: node linkType: hard -"semver@npm:^6.0.0, semver@npm:^6.1.1, semver@npm:^6.1.2, semver@npm:^6.2.0, semver@npm:^6.3.0": +"semver@npm:^6.0.0, semver@npm:^6.1.1, semver@npm:^6.1.2, semver@npm:^6.3.0": version: 6.3.0 resolution: "semver@npm:6.3.0" bin: @@ -6063,40 +5298,6 @@ fsevents@^2.3.2: languageName: node linkType: hard -"spdx-correct@npm:^3.0.0": - version: 3.1.1 - resolution: "spdx-correct@npm:3.1.1" - dependencies: - spdx-expression-parse: ^3.0.0 - spdx-license-ids: ^3.0.0 - checksum: f3413eb225ef9f13aa2ec05230ff7669bffad055a7f62ec85164dd27f00a9f1e19880554a8fa5350fc434764ff895836c207f98813511a0180b0e929581bfe01 - languageName: node - linkType: hard - -"spdx-exceptions@npm:^2.1.0": - version: 2.3.0 - resolution: "spdx-exceptions@npm:2.3.0" - checksum: 3cbd2498897dc384158666a9dd7435e3b42ece5da42fd967b218b790e248381d001ec77a676d13d1f4e8da317d97b7bc0ebf4fff37bfbb95923d49b024030c96 - languageName: node - linkType: hard - -"spdx-expression-parse@npm:^3.0.0": - version: 3.0.1 - resolution: "spdx-expression-parse@npm:3.0.1" - dependencies: - spdx-exceptions: ^2.1.0 - spdx-license-ids: ^3.0.0 - checksum: f0211cada3fa7cd9db2243143fb0e66e28a46d72d8268f38ad2196aac49408d87892cda6e5600d43d6b05ed2707cb2f4148deb27b092aafabc50a67038f4cbf5 - languageName: node - linkType: hard - -"spdx-license-ids@npm:^3.0.0": - version: 3.0.11 - resolution: "spdx-license-ids@npm:3.0.11" - checksum: e5cc15e726385e4b692be9a043dd6497d12194aa1674f86a11da123dfe85c9f40131a25dd902c84e35a97a743d266b39c279736e435b4ff85436a9d9be0d1665 - languageName: node - linkType: hard - "sprintf-js@npm:~1.0.2": version: 1.0.3 resolution: "sprintf-js@npm:1.0.3" @@ -6143,7 +5344,7 @@ fsevents@^2.3.2: languageName: node linkType: hard -"string-width@npm:^1.0.2 || 2 || 3 || 4, string-width@npm:^4.0.0, string-width@npm:^4.1.0, string-width@npm:^4.2.0, string-width@npm:^4.2.3": +"string-width@npm:^1.0.2 || 2 || 3 || 4, string-width@npm:^4.1.0, string-width@npm:^4.2.0, string-width@npm:^4.2.3": version: 4.2.3 resolution: "string-width@npm:4.2.3" dependencies: @@ -6195,15 +5396,6 @@ fsevents@^2.3.2: languageName: node linkType: hard -"strip-indent@npm:^3.0.0": - version: 3.0.0 - resolution: "strip-indent@npm:3.0.0" - dependencies: - min-indent: ^1.0.0 - checksum: 4a7860e94372753b90a48d032758464efbf194880880fd7636965b7137ae4af24ce77a43d223a602cac787e2e95214aaa2f2470a65986e3d6ffa0e1c3dd887f6 - languageName: node - linkType: hard - "strip-json-comments@npm:^3.1.0, strip-json-comments@npm:^3.1.1": version: 3.1.1 resolution: "strip-json-comments@npm:3.1.1" @@ -6211,13 +5403,6 @@ fsevents@^2.3.2: languageName: node linkType: hard -"strip-json-comments@npm:~2.0.1": - version: 2.0.1 - resolution: "strip-json-comments@npm:2.0.1" - checksum: e60d99aa2849c27a04dce0620334f45822197df6b83664dd3746971e9a0a766d989dbb8d87f9cb7350725d2b5df401a2343222ad06e36a1ba7d62c6633267fcb - languageName: node - linkType: hard - "supports-color@npm:^5.3.0": version: 5.5.0 resolution: "supports-color@npm:5.5.0" @@ -6289,13 +5474,6 @@ fsevents@^2.3.2: languageName: node linkType: hard -"term-size@npm:^2.1.0": - version: 2.2.1 - resolution: "term-size@npm:2.2.1" - checksum: a013f688f6fc1b6410be3b2f7a04c3a9169e97186949b0bc33cc7c1943b0c88d9a943f81e518d9227cb817803e7a18c702f2971eafd6d8659ce4a1df94094246 - languageName: node - linkType: hard - "terminal-link@npm:^2.0.0": version: 2.1.1 resolution: "terminal-link@npm:2.1.1" @@ -6345,13 +5523,6 @@ fsevents@^2.3.2: languageName: node linkType: hard -"to-readable-stream@npm:^1.0.0": - version: 1.0.0 - resolution: "to-readable-stream@npm:1.0.0" - checksum: aa4b65d3e7a60d7b51204585187bdfd2159788a22ec241451c782552699e8dec39dcb8a9cd4957e03f32191ca18d3ea80abd9bb40005a8f1631df8fbba22b413 - languageName: node - linkType: hard - "to-regex-range@npm:^5.0.1": version: 5.0.1 resolution: "to-regex-range@npm:5.0.1" @@ -6381,10 +5552,12 @@ fsevents@^2.3.2: languageName: node linkType: hard -"trim-newlines@npm:^3.0.0": - version: 3.0.1 - resolution: "trim-newlines@npm:3.0.1" - checksum: a1cc3d5992d47349fa0b48206038e524f42d0ade81913cc72322e4f5a99c5e936eb730af762c9f5bafa3c19ab1e9eaf14bdff487cbe3f2c5d525dd03f3f89fb0 +"tsd-lite@npm:^0.1.0": + version: 0.1.0 + resolution: "tsd-lite@npm:0.1.0" + peerDependencies: + "@tsd/typescript": ^3.8.3 || ^4.0.7 + checksum: 61cd45dc5a00866dbce2266adac7c722f1a42402f764a637fc30d23db51dab107e169032509667458fd0651bb584a531ed412621844768a1af951c19320233fd languageName: node linkType: hard @@ -6431,13 +5604,6 @@ fsevents@^2.3.2: languageName: node linkType: hard -"type-fest@npm:^0.13.1": - version: 0.13.1 - resolution: "type-fest@npm:0.13.1" - checksum: 11acce4f34c75a838914bdc4a0133d2dd0864e313897471974880df82624159521bae691a6100ff99f93be2d0f8871ecdab18573d2c67e61905cf2f5cbfa52a6 - languageName: node - linkType: hard - "type-fest@npm:^0.20.2": version: 0.20.2 resolution: "type-fest@npm:0.20.2" @@ -6452,20 +5618,6 @@ fsevents@^2.3.2: languageName: node linkType: hard -"type-fest@npm:^0.6.0": - version: 0.6.0 - resolution: "type-fest@npm:0.6.0" - checksum: c77f687caff9f8effffd6091fbdb57b8e7265213e067c34086d37dc6ac3b640abd3dd3921402a6ba9eb56621719c552ae5e91d183d1e6d075f9aff859a347f00 - languageName: node - linkType: hard - -"type-fest@npm:^0.8.1": - version: 0.8.1 - resolution: "type-fest@npm:0.8.1" - checksum: f8c4b4249f52e8bea7a4fc55b3653c96c2d547240e4c772e001d02b7cc38b8c3eb493ab9fbe985a76a203cd1aa7044776b728a71ba12bf36e7131f989597885b - languageName: node - linkType: hard - "typedarray-to-buffer@npm:^3.1.5": version: 3.1.5 resolution: "typedarray-to-buffer@npm:3.1.5" @@ -6544,15 +5696,6 @@ typescript@^4.4.4: languageName: node linkType: hard -"unique-string@npm:^2.0.0": - version: 2.0.0 - resolution: "unique-string@npm:2.0.0" - dependencies: - crypto-random-string: ^2.0.0 - checksum: a2748b41eaada391800773c16674fe4e9a3f078162e49b2c6b4e67d36061a0f97be4b7851136d786ed5e4ddc90770400fd54bf32aed1e08ec9a9219d9b66bad3 - languageName: node - linkType: hard - "universalify@npm:^0.1.2": version: 0.1.2 resolution: "universalify@npm:0.1.2" @@ -6560,27 +5703,6 @@ typescript@^4.4.4: languageName: node linkType: hard -"update-notifier@npm:^4.1.0": - version: 4.1.3 - resolution: "update-notifier@npm:4.1.3" - dependencies: - boxen: ^4.2.0 - chalk: ^3.0.0 - configstore: ^5.0.1 - has-yarn: ^2.1.0 - import-lazy: ^2.1.0 - is-ci: ^2.0.0 - is-installed-globally: ^0.3.1 - is-npm: ^4.0.0 - is-yarn-global: ^0.3.0 - latest-version: ^5.0.0 - pupa: ^2.0.1 - semver-diff: ^3.1.1 - xdg-basedir: ^4.0.0 - checksum: 90362dcdf349651f92cffc6b9c1dfe6cb1035c1af3e4952316800d7aa05e98ba7bd291edd315aa215ce3f9b4b246f1fc2489a25c85c6fee8bdd0163731b3e1fa - languageName: node - linkType: hard - "uri-js@npm:^4.2.2": version: 4.4.1 resolution: "uri-js@npm:4.4.1" @@ -6590,15 +5712,6 @@ typescript@^4.4.4: languageName: node linkType: hard -"url-parse-lax@npm:^3.0.0": - version: 3.0.0 - resolution: "url-parse-lax@npm:3.0.0" - dependencies: - prepend-http: ^2.0.0 - checksum: 334817036b300c35023798b8ceac23ea61b51f231a867112e3a85778d65191a3ccb67e7b69b608d45433d55da392cf0d72cd3c85f2542f6ec34733e455c229d5 - languageName: node - linkType: hard - "util-deprecate@npm:~1.0.1": version: 1.0.2 resolution: "util-deprecate@npm:1.0.2" @@ -6624,16 +5737,6 @@ typescript@^4.4.4: languageName: node linkType: hard -"validate-npm-package-license@npm:^3.0.1": - version: 3.0.4 - resolution: "validate-npm-package-license@npm:3.0.4" - dependencies: - spdx-correct: ^3.0.0 - spdx-expression-parse: ^3.0.0 - checksum: 940899bd4eacfa012ceecb10a5814ba0e8103da5243aa74d0d62f1f8a405efcd23e034fb7193e2d05b392870c53aabcb1f66439b062075cdcb28bc5d562a8ff6 - languageName: node - linkType: hard - "w3c-hr-time@npm:^1.0.2": version: 1.0.2 resolution: "w3c-hr-time@npm:1.0.2" @@ -6722,15 +5825,6 @@ typescript@^4.4.4: languageName: node linkType: hard -"widest-line@npm:^3.1.0": - version: 3.1.0 - resolution: "widest-line@npm:3.1.0" - dependencies: - string-width: ^4.0.0 - checksum: 729c30582e49bdcb1372216eedfd71d1640a1344a4b4e970bc9f33d575b56b130f530b383fbab2cf2bcffb76ea4357e6a66939778d8de91ca66037651d94e01a - languageName: node - linkType: hard - "word-wrap@npm:^1.2.3, word-wrap@npm:~1.2.3": version: 1.2.3 resolution: "word-wrap@npm:1.2.3" @@ -6783,13 +5877,6 @@ typescript@^4.4.4: languageName: node linkType: hard -"xdg-basedir@npm:^4.0.0": - version: 4.0.0 - resolution: "xdg-basedir@npm:4.0.0" - checksum: 928953cb7dda8e2475932f748847a3aae751f44864a0067b03e5ca66820a36e1e9ffb647f9b06fb68ebcb0b9d06d5aee630717a1d2501be14cec99f82efa2fe6 - languageName: node - linkType: hard - "xml-name-validator@npm:^3.0.0": version: 3.0.0 resolution: "xml-name-validator@npm:3.0.0" @@ -6818,16 +5905,6 @@ typescript@^4.4.4: languageName: node linkType: hard -"yargs-parser@npm:^18.1.3": - version: 18.1.3 - resolution: "yargs-parser@npm:18.1.3" - dependencies: - camelcase: ^5.0.0 - decamelize: ^1.2.0 - checksum: 33871721679053cc38165afc6356c06c3e820459589b5db78f315886105070eb90cbb583cd6515fa4231937d60c80262ca2b7c486d5942576802446318a39597 - languageName: node - linkType: hard - "yargs-parser@npm:^20.2.2": version: 20.2.9 resolution: "yargs-parser@npm:20.2.9" From 7b1ce0e0fa34461fe29b8fd569369c64670345c2 Mon Sep 17 00:00:00 2001 From: mrazauskas <72159681+mrazauskas@users.noreply.github.com> Date: Wed, 5 Jan 2022 12:25:12 +0200 Subject: [PATCH 02/19] chore: add license --- LICENSE.md | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 LICENSE.md diff --git a/LICENSE.md b/LICENSE.md new file mode 100644 index 0000000..372741f --- /dev/null +++ b/LICENSE.md @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) Jest Community + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. From 26b6209dd3769e130b836fe2ca676bdb30bf8c7c Mon Sep 17 00:00:00 2001 From: mrazauskas <72159681+mrazauskas@users.noreply.github.com> Date: Wed, 5 Jan 2022 12:26:01 +0200 Subject: [PATCH 03/19] chore: improve documentation --- README.md | 95 +++++++++++++++++++++---------------------------------- 1 file changed, 36 insertions(+), 59 deletions(-) diff --git a/README.md b/README.md index ad24eb9..117c0a1 100644 --- a/README.md +++ b/README.md @@ -1,84 +1,61 @@ -# `jest-runner-tsd` +# jest-runner-tsd -A Jest runner that tests typescript typings using [tsd](https://github.com/SamVerschueren/tsd) under the hood. +> Run your TypeScript type tests using Jest. -## Install - -Install `jest-runner-tsd` +[![version](https://img.shields.io/npm/v/jest-runner-tsd.svg)](https://npmjs.com/package/jest-runner-tsd) +[![license](https://img.shields.io/github/license/jest-community/jest-runner-tsd.svg)](https://github.com/jest-community/jest-runner-tsd/blob/main/LICENSE.md) -```bash -yarn add --dev jest-runner-tsd +Note that since `v2` the `jest-runner-tsd` is using [`tsd-lite`](https://github.com/mrazauskas/tsd-lite) instead of [`tsd`](https://github.com/SamVerschueren/tsd). The type testing logic is the same in both implementations, i.e. both of them are wrapping around the [TypeScript compiler](https://github.com/microsoft/TypeScript/wiki/Using-the-Compiler-API) to analyze types of your code. -# or with NPM +## Differences from `tsd` -npm install --save-dev jest-runner-tsd -``` +The usage of `tsd` with monorepos written in TypeScript may become [cumbersome](https://github.com/SamVerschueren/tsd/issues/32), because of checks unrelated with types. `tsd-light` is an attempt to address these and similar issues. -### Adding to Jest Config +Notable differences: -Create a `jest.config.types.js` file and have the runner property set to `jest-runner-tsd` as shown below: +- The `tsd` configuration in `package.json` is ignored. Please use `jest.config` to configure discovery of your test files and `tsconfig.json` to provide configuration for TS compiler. +- The compiler configuration will be read from the nearest `tsconfig.json` for each test file. Hence, you may have a configuration for the whole project, or a group of test files, or just a particular test file. +- `tsd-lite` will use the default TS compiler configuration without altering it. This means you should set `"strict": true` to use strict assertions, which are the default ones in vanilla `tsd`. +- Only type testing is performed without any additional checks or rules. +- The `printType` helper is discarded. -```js -module.exports = { - runner: 'jest-runner-tsd', -}; -``` - -In the project `package.json` file, modify the scripts block to use the configuration file as show below: - -```json -... -"scripts": { - ... - "type-tests": "yarn jest --config jest.config.types.js" -} -... -``` - -### Run - -To start the test, just execute the following command +## Install ```bash -yarn test-types +yarn add -D jest-runner-tsd @tsd/typescript ``` -## Writing tests - -> This runner uses TSD. To see the available assertions, checkout it's [documentation](https://github.com/SamVerschueren/tsd) +Remember to install `@tsd/typescript` package. It is a required peer dependency. -### For JavaScript Projects +### Usage -There are multiple ways you can pass a type definition file. +1. If your type tests live inside `__typetests__` folders, set up `jest.config.tsd.js` like this: -#### Default - -The type definitions should be in a file named `index.d.ts` in the root directory of the project by default. +```js +module.exports = { + displayName: { + color: 'blue', + name: 'types', + }, + runner: 'jest-runner-tsd', + testMatch: ['**/__typetests__/**/*.test.ts'], +}; +``` -#### `types` property in package.json +2. Add [`tsconfig.json`](https://www.typescriptlang.org/docs/handbook/tsconfig-json.html) to your project with configuration for TS compiler. -You can also set your `types` property in package.json. The runner will automatically pick the type defintion file from there. +3. Run `yarn jest -c jest.config.tsd.js` command or just include a script in `package.json`: ```json -{ - ... - "types": "path/to/types.d.ts" +"scripts": { + "test:types": "jest -c jest.config.tsd.js" } ``` -#### Docblocks - -If the type definition file is located somewhere else then specify its path in the top of respective test file using the `@type` inside a docblock. - -```ts -/** - * @type ../../custom/path/to/types.d.ts - **/ -``` +## Tests -### For TypeScript Projects +To learn more about `tsd` tests and assertions see the [documentation](https://github.com/SamVerschueren/tsd). -> **Note:** This is only a workaround. A stable solution may be introduced in future. +## License -Due to [limitations in TSD](https://github.com/SamVerschueren/tsd/issues/32), the only solution now for testing types in TypeScript projects -would be to have a empty type definition file and specify it's path using one of the many methods explained above. +[MIT](https://github.com/jest-community/jest-runner-tsd/blob/main/LICENSE.md) © Jest Community From 405e01e514ae06fd5596fe915ace55f0b50c6f8e Mon Sep 17 00:00:00 2001 From: mrazauskas <72159681+mrazauskas@users.noreply.github.com> Date: Wed, 5 Jan 2022 12:26:21 +0200 Subject: [PATCH 04/19] chore: tweak package.json metadata --- package.json | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/package.json b/package.json index d35b4e0..0286491 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,19 @@ { "name": "jest-runner-tsd", "version": "1.2.0", - "description": "A Jest runner that tests typescript typings using tsd under the hood", + "description": "Run your TypeScript type tests using Jest", + "keywords": [ + "check", + "checker", + "easy", + "jest", + "runner", + "tests", + "tsd", + "typings", + "types", + "typescript" + ], "license": "MIT", "repository": "https://github.com/jest-community/jest-runner-tsd.git", "main": "src/index.js", From 12f851b3ff9aaa63e6cd7968c667de4243f2a407 Mon Sep 17 00:00:00 2001 From: mrazauskas <72159681+mrazauskas@users.noreply.github.com> Date: Wed, 12 Jan 2022 11:38:02 +0200 Subject: [PATCH 05/19] bump `tsd-lite` version --- .eslintignore | 4 + e2e/__fixtures__/errors-syntax/index.d.ts | 7 ++ e2e/__fixtures__/errors-syntax/index.js | 3 + e2e/__fixtures__/errors-syntax/index.test.ts | 5 ++ e2e/__fixtures__/errors-syntax/package.json | 8 ++ .../errors-tsconfig/index.test.ts | 3 + e2e/__fixtures__/errors-tsconfig/package.json | 8 ++ .../errors-tsconfig/tsconfig.json | 9 +++ e2e/__snapshots__/errors.test.ts.snap | 40 ++++++++++ e2e/__snapshots__/failing.test.ts.snap | 6 +- e2e/errors.test.ts | 10 +++ e2e/tsconfig.json | 7 +- package.json | 2 +- src/formatErrorMessage.js | 51 ------------ src/formatter.js | 78 +++++++++++++++++++ src/run.js | 20 +++-- yarn.lock | 14 ++-- 17 files changed, 203 insertions(+), 72 deletions(-) create mode 100644 .eslintignore create mode 100644 e2e/__fixtures__/errors-syntax/index.d.ts create mode 100644 e2e/__fixtures__/errors-syntax/index.js create mode 100644 e2e/__fixtures__/errors-syntax/index.test.ts create mode 100644 e2e/__fixtures__/errors-syntax/package.json create mode 100644 e2e/__fixtures__/errors-tsconfig/index.test.ts create mode 100644 e2e/__fixtures__/errors-tsconfig/package.json create mode 100644 e2e/__fixtures__/errors-tsconfig/tsconfig.json create mode 100644 e2e/__snapshots__/errors.test.ts.snap create mode 100644 e2e/errors.test.ts delete mode 100644 src/formatErrorMessage.js create mode 100644 src/formatter.js diff --git a/.eslintignore b/.eslintignore new file mode 100644 index 0000000..f2ee6a2 --- /dev/null +++ b/.eslintignore @@ -0,0 +1,4 @@ +.yarn +build +coverage +e2e/__fixtures__/errors-syntax diff --git a/e2e/__fixtures__/errors-syntax/index.d.ts b/e2e/__fixtures__/errors-syntax/index.d.ts new file mode 100644 index 0000000..64399b7 --- /dev/null +++ b/e2e/__fixtures__/errors-syntax/index.d.ts @@ -0,0 +1,7 @@ +/* eslint-disable no-unused-vars */ +declare const one: { + (foo: string, bar: string): string; + (foo: number, bar: number): number; +}; + +export default one; diff --git a/e2e/__fixtures__/errors-syntax/index.js b/e2e/__fixtures__/errors-syntax/index.js new file mode 100644 index 0000000..beafd08 --- /dev/null +++ b/e2e/__fixtures__/errors-syntax/index.js @@ -0,0 +1,3 @@ +module.exports.default = (foo, bar) => { + return foo + bar; +}; diff --git a/e2e/__fixtures__/errors-syntax/index.test.ts b/e2e/__fixtures__/errors-syntax/index.test.ts new file mode 100644 index 0000000..28008f3 --- /dev/null +++ b/e2e/__fixtures__/errors-syntax/index.test.ts @@ -0,0 +1,5 @@ +import { expectError } from 'tsd-lite'; +import one from '.'; + +expectError(one('foo', 'bar'); +expectError(one('foo' 'bar')); diff --git a/e2e/__fixtures__/errors-syntax/package.json b/e2e/__fixtures__/errors-syntax/package.json new file mode 100644 index 0000000..1431636 --- /dev/null +++ b/e2e/__fixtures__/errors-syntax/package.json @@ -0,0 +1,8 @@ +{ + "jest": { + "runner": "../../../src/", + "testMatch": [ + "**/*.test.ts" + ] + } +} diff --git a/e2e/__fixtures__/errors-tsconfig/index.test.ts b/e2e/__fixtures__/errors-tsconfig/index.test.ts new file mode 100644 index 0000000..f8d98fd --- /dev/null +++ b/e2e/__fixtures__/errors-tsconfig/index.test.ts @@ -0,0 +1,3 @@ +import { expectType } from 'tsd-lite'; + +expectType('dummy test'); diff --git a/e2e/__fixtures__/errors-tsconfig/package.json b/e2e/__fixtures__/errors-tsconfig/package.json new file mode 100644 index 0000000..1431636 --- /dev/null +++ b/e2e/__fixtures__/errors-tsconfig/package.json @@ -0,0 +1,8 @@ +{ + "jest": { + "runner": "../../../src/", + "testMatch": [ + "**/*.test.ts" + ] + } +} diff --git a/e2e/__fixtures__/errors-tsconfig/tsconfig.json b/e2e/__fixtures__/errors-tsconfig/tsconfig.json new file mode 100644 index 0000000..406c8b2 --- /dev/null +++ b/e2e/__fixtures__/errors-tsconfig/tsconfig.json @@ -0,0 +1,9 @@ +{ + "compilerOptions": { + "module": "random", + "target": "es2019", + "strict": "yes", + "noEmitOnError": true + }, + "include": ["./src/**/*"] +} diff --git a/e2e/__snapshots__/errors.test.ts.snap b/e2e/__snapshots__/errors.test.ts.snap new file mode 100644 index 0000000..abb3fe8 --- /dev/null +++ b/e2e/__snapshots__/errors.test.ts.snap @@ -0,0 +1,40 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`throws if nearest tsconfig.json is not valid 1`] = ` +"FAIL e2e/__fixtures__/errors-tsconfig/index.test.ts + ● Test suite failed to run + Argument for '--module' option must be: 'none', 'commonjs', 'amd', 'system', 'umd', 'es6', 'es2015', 'es2020', 'esnext'. + > 3 | \\"module\\": \\"random\\", + | ^ + at e2e/__fixtures__/errors-tsconfig/tsconfig.json:3:15 + Compiler option 'strict' requires a value of type boolean. + > 5 | \\"strict\\": \\"yes\\", + | ^ + at e2e/__fixtures__/errors-tsconfig/tsconfig.json:5:15 + No inputs were found in config file '/mocked-path-to-jest-runner-tsd/e2e/__fixtures__/errors-tsconfig/tsconfig.json'. Specified 'include' paths were '[\\"./src/**/*\\"]' and 'exclude' paths were '[]'. +Test Suites: 1 failed, 1 total +Tests: 0 total +Snapshots: 0 total +Time: +Ran all test suites. +" +`; + +exports[`throws if syntax error is encountered 1`] = ` +"FAIL e2e/__fixtures__/errors-syntax/index.test.ts + ● Test suite failed to run + SyntaxError: ')' expected. + > 4 | expectError(one('foo', 'bar'); + | ^ + at e2e/__fixtures__/errors-syntax/index.test.ts:4:30 + SyntaxError: ',' expected. + > 5 | expectError(one('foo' 'bar')); + | ^ + at e2e/__fixtures__/errors-syntax/index.test.ts:5:23 +Test Suites: 1 failed, 1 total +Tests: 0 total +Snapshots: 0 total +Time: +Ran all test suites. +" +`; diff --git a/e2e/__snapshots__/failing.test.ts.snap b/e2e/__snapshots__/failing.test.ts.snap index 5004295..bec8b9b 100644 --- a/e2e/__snapshots__/failing.test.ts.snap +++ b/e2e/__snapshots__/failing.test.ts.snap @@ -7,7 +7,7 @@ exports[`works with failing JS test 1`] = ` Argument of type 'number' is not assignable to parameter of type 'string'. > 5 | expectType(concat(1, 2)); | ^ - at index.test.ts:5:20 + at e2e/__fixtures__/js-failing/index.test.ts:5:20 Test Suites: 1 failed, 1 total Tests: 1 failed, 1 passed, 2 total Snapshots: 0 total @@ -23,11 +23,11 @@ exports[`works with failing TS test 1`] = ` Argument of type 'Date' is not assignable to parameter of type 'string'. > 5 | expectType(makeDate(5, 5, 5)); | ^ - at index.test.ts:5:20 + at e2e/__fixtures__/ts-failing/index.test.ts:5:20 Expected an error, but found none. > 7 | expectError(makeDate(1, 3, 6)); | ^ - at index.test.ts:7:1 + at e2e/__fixtures__/ts-failing/index.test.ts:7:1 Test Suites: 1 failed, 1 total Tests: 2 failed, 2 passed, 4 total Snapshots: 0 total diff --git a/e2e/errors.test.ts b/e2e/errors.test.ts new file mode 100644 index 0000000..349eaa3 --- /dev/null +++ b/e2e/errors.test.ts @@ -0,0 +1,10 @@ +import { expect, test } from '@jest/globals'; +import runJest from './runJest'; + +test('throws if syntax error is encountered', async () => { + expect(await runJest('errors-syntax')).toMatchSnapshot(); +}); + +test('throws if nearest tsconfig.json is not valid', async () => { + expect(await runJest('errors-tsconfig')).toMatchSnapshot(); +}); diff --git a/e2e/tsconfig.json b/e2e/tsconfig.json index 9b58808..9dea775 100644 --- a/e2e/tsconfig.json +++ b/e2e/tsconfig.json @@ -1,11 +1,10 @@ { "compilerOptions": { - "target": "es6", + "target": "es2019", "module": "commonjs", "moduleResolution": "node", - "strict": true, - "noImplicitOverride": true, - "skipLibCheck": true + "skipLibCheck": true, + "strict": true }, "include": ["**/*"] } diff --git a/package.json b/package.json index 0286491..ab53a34 100644 --- a/package.json +++ b/package.json @@ -32,7 +32,7 @@ "@babel/code-frame": "^7.15.8", "chalk": "^4.1.2", "create-jest-runner": "^0.9.0", - "tsd-lite": "^0.1.0" + "tsd-lite": "^0.2.0" }, "devDependencies": { "@babel/core": "^7.15.8", diff --git a/src/formatErrorMessage.js b/src/formatErrorMessage.js deleted file mode 100644 index 1b6c6ad..0000000 --- a/src/formatErrorMessage.js +++ /dev/null @@ -1,51 +0,0 @@ -const { basename } = require('path'); -const { codeFrameColumns } = require('@babel/code-frame'); -const chalk = require('chalk'); - -const BULLET = '\u25cf '; - -const TITLE_INDENT = ' '; -const MESSAGE_INDENT = ' '; -const CODE_INDENT = ' '; -const LOCATION_INDENT = ' '; - -const NOT_EMPTY_LINE_REGEXP = /^(?!$)/gm; - -/** - * @param {string} lines - * @param {string} indent - */ -const indentAllLines = (lines, indent) => - lines.replace(NOT_EMPTY_LINE_REGEXP, indent); - -module.exports = diagnostics => { - const title = chalk.bold.red(TITLE_INDENT + BULLET + 'tsd typecheck') + '\n'; - - const messages = []; - - diagnostics.forEach(error => { - const { column, fileName, fileText, line, message } = error; - - const codeFrame = codeFrameColumns( - fileText, - { start: { column, line } }, - { highlightCode: true, linesAbove: 0, linesBelow: 0 } - ); - - const location = - chalk.dim('at ') + - chalk.cyan(basename(fileName)) + - chalk.dim(':' + line + ':' + column); - - messages.push( - indentAllLines(message, MESSAGE_INDENT) + - '\n\n' + - indentAllLines(codeFrame, CODE_INDENT) + - '\n\n' + - indentAllLines(location, LOCATION_INDENT) + - '\n' - ); - }); - - return title + '\n' + messages.join('\n\n'); -}; diff --git a/src/formatter.js b/src/formatter.js new file mode 100644 index 0000000..5acf243 --- /dev/null +++ b/src/formatter.js @@ -0,0 +1,78 @@ +const { posix, relative, sep } = require('path'); +const { codeFrameColumns } = require('@babel/code-frame'); +const chalk = require('chalk'); + +const NOT_EMPTY_LINE_REGEXP = /^(?!$)/gm; +const INDENT = ' '; + +/** + * @param {string} lines + * @param {number} level + */ +const indentEachLine = (lines, level) => + lines.replace(NOT_EMPTY_LINE_REGEXP, INDENT.repeat(level)); + +const BULLET = '\u25cf '; + +/** + * @param {string} title + */ +const makeTitle = title => indentEachLine(BULLET + title + '\n', 1); + +/** + * @param {string} input + */ +const normalizeSlashes = input => input.split(sep).join(posix.sep); + +function getCodeFrameAndLocation(file, start) { + const { line, character } = file.getLineAndCharacterOfPosition(start); + + const codeFrame = codeFrameColumns( + file.text, + { start: { line: line + 1, column: character + 1 } }, + { highlightCode: true, linesAbove: 0, linesBelow: 0 } + ); + + const location = + chalk.dim('at ') + + chalk.cyan(normalizeSlashes(relative('', file.fileName))) + + chalk.dim(':' + (line + 1) + ':' + (character + 1)); + + return { codeFrame, location }; +} + +module.exports.formatTsdErrors = tsdErrors => { + const messages = tsdErrors.map(error => { + if (error.file) { + const { codeFrame, location } = getCodeFrameAndLocation( + error.file, + error.start + ); + + return [error.message, codeFrame, location].join('\n\n'); + } + + return error.message; + }); + + return messages.join('\n\n'); +}; + +module.exports.formatTsdResults = tsdResults => { + const title = chalk.bold.red(makeTitle('tsd typecheck')); + + const messages = tsdResults.map(result => { + const { codeFrame, location } = getCodeFrameAndLocation( + result.file, + result.start + ); + + return [ + indentEachLine(result.message, 2), + indentEachLine(codeFrame, 2), + indentEachLine(location, 3), + ].join('\n\n'); + }); + + return [title, messages.join('\n\n'), ''].join('\n'); +}; diff --git a/src/run.js b/src/run.js index 11ac395..f237b59 100644 --- a/src/run.js +++ b/src/run.js @@ -1,22 +1,28 @@ const tsdLite = require('tsd-lite'); -const formatErrorMessage = require('./formatErrorMessage'); -const { pass } = require('./pass'); +const { formatTsdErrors, formatTsdResults } = require('./formatter'); const { fail } = require('./fail'); +const { pass } = require('./pass'); const TEST_TITLE = 'tsd typecheck'; module.exports = async ({ testPath }) => { const start = Date.now(); - const { assertionCount, diagnostics } = tsdLite.default(testPath); + const { assertionsCount, tsdErrors, tsdResults } = tsdLite.default(testPath); const end = Date.now(); - const numFailed = diagnostics.length; - const numPassed = assertionCount - numFailed; + if (tsdErrors !== undefined) { + const message = formatTsdErrors(tsdErrors); + + throw { message, stack: '' }; + } + + const numFailed = tsdResults.length; + const numPassed = assertionsCount - numFailed; - if (diagnostics.length > 0) { - const errorMessage = formatErrorMessage(diagnostics); + if (tsdResults.length > 0) { + const errorMessage = formatTsdResults(tsdResults); return fail({ start, diff --git a/yarn.lock b/yarn.lock index 8f78a26..6dfb2b1 100644 --- a/yarn.lock +++ b/yarn.lock @@ -3956,7 +3956,7 @@ fsevents@^2.3.2: "@babel/core": ^7.15.8 "@babel/preset-env": ^7.15.8 "@babel/preset-typescript": ^7.15.0 - "@tsd/typescript": 4.4.4 + "@tsd/typescript": ^4.4.4 "@typescript-eslint/eslint-plugin": ^4.33.0 "@typescript-eslint/parser": ^4.33.0 babel-jest: ^27.2.5 @@ -3968,8 +3968,10 @@ fsevents@^2.3.2: execa: ^5.1.1 jest: ^27.2.5 prettier: ^2.4.1 - tsd-lite: ^0.1.0 + tsd-lite: ^0.2.0 typescript: ^4.4.4 + peerDependencies: + "@tsd/typescript": ^3.8.3 || ^4.0.7 languageName: unknown linkType: soft @@ -5552,12 +5554,12 @@ fsevents@^2.3.2: languageName: node linkType: hard -"tsd-lite@npm:^0.1.0": - version: 0.1.0 - resolution: "tsd-lite@npm:0.1.0" +"tsd-lite@npm:^0.2.0": + version: 0.2.0 + resolution: "tsd-lite@npm:0.2.0" peerDependencies: "@tsd/typescript": ^3.8.3 || ^4.0.7 - checksum: 61cd45dc5a00866dbce2266adac7c722f1a42402f764a637fc30d23db51dab107e169032509667458fd0651bb584a531ed412621844768a1af951c19320233fd + checksum: 4bd2b883cda48bea22225bceadfd268511e143a9c9d6a86e8e8a6d7ef9e5b055a6046b2e7348cbb6a7739297d84f75ca227d81966599ff62c1c12c6d12eea8df languageName: node linkType: hard From 75f09159fb28e69b48a2f3663fa068e5e9623eeb Mon Sep 17 00:00:00 2001 From: mrazauskas <72159681+mrazauskas@users.noreply.github.com> Date: Wed, 12 Jan 2022 11:48:46 +0200 Subject: [PATCH 06/19] simplify test --- e2e/__fixtures__/errors-tsconfig/tsconfig.json | 2 +- e2e/__snapshots__/errors.test.ts.snap | 1 - 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/e2e/__fixtures__/errors-tsconfig/tsconfig.json b/e2e/__fixtures__/errors-tsconfig/tsconfig.json index 406c8b2..3ab3096 100644 --- a/e2e/__fixtures__/errors-tsconfig/tsconfig.json +++ b/e2e/__fixtures__/errors-tsconfig/tsconfig.json @@ -5,5 +5,5 @@ "strict": "yes", "noEmitOnError": true }, - "include": ["./src/**/*"] + "include": ["./**/*"] } diff --git a/e2e/__snapshots__/errors.test.ts.snap b/e2e/__snapshots__/errors.test.ts.snap index abb3fe8..ff1ca0f 100644 --- a/e2e/__snapshots__/errors.test.ts.snap +++ b/e2e/__snapshots__/errors.test.ts.snap @@ -11,7 +11,6 @@ exports[`throws if nearest tsconfig.json is not valid 1`] = ` > 5 | \\"strict\\": \\"yes\\", | ^ at e2e/__fixtures__/errors-tsconfig/tsconfig.json:5:15 - No inputs were found in config file '/mocked-path-to-jest-runner-tsd/e2e/__fixtures__/errors-tsconfig/tsconfig.json'. Specified 'include' paths were '[\\"./src/**/*\\"]' and 'exclude' paths were '[]'. Test Suites: 1 failed, 1 total Tests: 0 total Snapshots: 0 total From 33b606952f91a2dca79915ffe5991d5ca127fb35 Mon Sep 17 00:00:00 2001 From: mrazauskas <72159681+mrazauskas@users.noreply.github.com> Date: Fri, 14 Jan 2022 19:23:38 +0200 Subject: [PATCH 07/19] add override test --- e2e/__fixtures__/override-tsconfig/index.test.ts | 14 ++++++++++++++ e2e/__fixtures__/override-tsconfig/package.json | 6 ++++++ e2e/__fixtures__/override-tsconfig/tsconfig.json | 7 +++++++ e2e/__snapshots__/override.test.ts.snap | 12 ++++++++++++ e2e/override.test.ts | 6 ++++++ 5 files changed, 45 insertions(+) create mode 100644 e2e/__fixtures__/override-tsconfig/index.test.ts create mode 100644 e2e/__fixtures__/override-tsconfig/package.json create mode 100644 e2e/__fixtures__/override-tsconfig/tsconfig.json create mode 100644 e2e/__snapshots__/override.test.ts.snap create mode 100644 e2e/override.test.ts diff --git a/e2e/__fixtures__/override-tsconfig/index.test.ts b/e2e/__fixtures__/override-tsconfig/index.test.ts new file mode 100644 index 0000000..5f95244 --- /dev/null +++ b/e2e/__fixtures__/override-tsconfig/index.test.ts @@ -0,0 +1,14 @@ +// Adapted from: https://www.typescriptlang.org/tsconfig#strictNullChecks + +import { expectType } from 'tsd-lite'; + +declare const loggedInUsername: string; + +const users = [ + { name: 'Oby', age: 12 }, + { name: 'Heera', age: 32 }, +]; + +const loggedInUser = users.find(u => u.name === loggedInUsername); + +expectType(loggedInUser.age); diff --git a/e2e/__fixtures__/override-tsconfig/package.json b/e2e/__fixtures__/override-tsconfig/package.json new file mode 100644 index 0000000..e6592ef --- /dev/null +++ b/e2e/__fixtures__/override-tsconfig/package.json @@ -0,0 +1,6 @@ +{ + "jest": { + "runner": "../../../src/", + "testMatch": ["**/*.test.ts"] + } +} diff --git a/e2e/__fixtures__/override-tsconfig/tsconfig.json b/e2e/__fixtures__/override-tsconfig/tsconfig.json new file mode 100644 index 0000000..338e09b --- /dev/null +++ b/e2e/__fixtures__/override-tsconfig/tsconfig.json @@ -0,0 +1,7 @@ +{ + "extends": "../../tsconfig.json", + "compilerOptions": { + "strict": false + }, + "include": ["**/*"] +} diff --git a/e2e/__snapshots__/override.test.ts.snap b/e2e/__snapshots__/override.test.ts.snap new file mode 100644 index 0000000..dd74686 --- /dev/null +++ b/e2e/__snapshots__/override.test.ts.snap @@ -0,0 +1,12 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`overrides "strict": true in tsconfig 1`] = ` +"PASS e2e/__fixtures__/override-tsconfig/index.test.ts + ✓ tsd typecheck +Test Suites: 1 passed, 1 total +Tests: 1 passed, 1 total +Snapshots: 0 total +Time: +Ran all test suites. +" +`; diff --git a/e2e/override.test.ts b/e2e/override.test.ts new file mode 100644 index 0000000..af7529c --- /dev/null +++ b/e2e/override.test.ts @@ -0,0 +1,6 @@ +import { expect, test } from '@jest/globals'; +import runJest from './runJest'; + +test('overrides "strict": true in tsconfig', async () => { + expect(await runJest('override-tsconfig')).toMatchSnapshot(); +}); From 3eb1de44d54d47c5c22e4f5224a5c0736ce5bbab Mon Sep 17 00:00:00 2001 From: mrazauskas <72159681+mrazauskas@users.noreply.github.com> Date: Fri, 14 Jan 2022 19:24:11 +0200 Subject: [PATCH 08/19] improve readme --- README.md | 63 +++++++++++++++++++++++++++++++++++++++---------------- 1 file changed, 45 insertions(+), 18 deletions(-) diff --git a/README.md b/README.md index 117c0a1..72d91f5 100644 --- a/README.md +++ b/README.md @@ -5,19 +5,13 @@ [![version](https://img.shields.io/npm/v/jest-runner-tsd.svg)](https://npmjs.com/package/jest-runner-tsd) [![license](https://img.shields.io/github/license/jest-community/jest-runner-tsd.svg)](https://github.com/jest-community/jest-runner-tsd/blob/main/LICENSE.md) -Note that since `v2` the `jest-runner-tsd` is using [`tsd-lite`](https://github.com/mrazauskas/tsd-lite) instead of [`tsd`](https://github.com/SamVerschueren/tsd). The type testing logic is the same in both implementations, i.e. both of them are wrapping around the [TypeScript compiler](https://github.com/microsoft/TypeScript/wiki/Using-the-Compiler-API) to analyze types of your code. +**Note:** the `jest-runner-tsd` is using [`tsd-lite`](https://github.com/mrazauskas/tsd-lite) instead of [`tsd`](https://github.com/SamVerschueren/tsd). Both of them have the same type testing logic, but `tsd-light` makes it easier to test projects written in TypeScript (or types generated by your library). -## Differences from `tsd` +Most important differences (for the full list see [`tsd-lite` repo](https://github.com/mrazauskas/tsd-lite)): -The usage of `tsd` with monorepos written in TypeScript may become [cumbersome](https://github.com/SamVerschueren/tsd/issues/32), because of checks unrelated with types. `tsd-light` is an attempt to address these and similar issues. - -Notable differences: - -- The `tsd` configuration in `package.json` is ignored. Please use `jest.config` to configure discovery of your test files and `tsconfig.json` to provide configuration for TS compiler. -- The compiler configuration will be read from the nearest `tsconfig.json` for each test file. Hence, you may have a configuration for the whole project, or a group of test files, or just a particular test file. -- `tsd-lite` will use the default TS compiler configuration without altering it. This means you should set `"strict": true` to use strict assertions, which are the default ones in vanilla `tsd`. -- Only type testing is performed without any additional checks or rules. -- The `printType` helper is discarded. +- `tsd-lite` has no additional [rules](https://github.com/SamVerschueren/tsd/issues/32) or checks; +- `jest.config` is used to discover test files; +- and `tsconfig.json` provides configuration for TS compiler. For details see [Configuration](#configuration) section. ## Install @@ -27,9 +21,11 @@ yarn add -D jest-runner-tsd @tsd/typescript Remember to install `@tsd/typescript` package. It is a required peer dependency. -### Usage +## Configuration + +### Jest -1. If your type tests live inside `__typetests__` folders, set up `jest.config.tsd.js` like this: +First of all, you should [configure Jest](https://jestjs.io/docs/configuration) to discover your test files. For example, if the files are suffix with `.test.ts` and live inside `__typetests__` directory, set up `jest.config.tsd.js` like this: ```js module.exports = { @@ -38,13 +34,44 @@ module.exports = { name: 'types', }, runner: 'jest-runner-tsd', - testMatch: ['**/__typetests__/**/*.test.ts'], + testMatch: ['**/__typetests__/*.test.ts'], }; ``` -2. Add [`tsconfig.json`](https://www.typescriptlang.org/docs/handbook/tsconfig-json.html) to your project with configuration for TS compiler. +### TS Compiler + +Your test files will be compiled using the [TypeScript compiler](https://github.com/microsoft/TypeScript/wiki/Using-the-Compiler-API) (similarly to `tsc`), but, instead of emitting JS code, `tsd-lite` will analyze types and diagnostics returned by the compiler. + +To compile each test file, `tsd-lite` will read the nearest [`tsconfig.json`](https://www.typescriptlang.org/docs/handbook/tsconfig-json.html) and will pass the configuration to the compiler. Hence, you may have a configuration for the whole project, or a group of test files, or just a particular test file. + +For example, if your project already includes a `tsconfig.json` in the root directory, but you prefer to have different configuration for testing, simply add another `tsconfig.json` to a directory with the test files. It may override or extend your root configuration. + +**Note:** if `tsconfig.json` is not found, the compiler will fall back to the default configuration. + +### Optionally Strict + +Just like TypeScript, `tsd-lite` is [optionally strict](https://www.typescriptlang.org/docs/handbook/2/basic-types.html#strictness). In contrary, the vanilla `tsd` is strict by default. If you are migrating your test suite, remember to set `"strict": true` in `tsconfig.json`. + +```ts +import { expectType } from 'tsd-lite'; + +declare const loggedInUsername: string; + +const users = [ + { name: 'Oby', age: 12 }, + { name: 'Heera', age: 32 }, +]; + +const loggedInUser = users.find(u => u.name === loggedInUsername); + +expectType(loggedInUser.age); +``` + +The assertion in this example fails with `"strict": true`, but passes with `"strict": false`. + +## Running Tests -3. Run `yarn jest -c jest.config.tsd.js` command or just include a script in `package.json`: +If all is set, simply run `yarn jest -c jest.config.tsd.js` command. Or better include a script in `package.json`: ```json "scripts": { @@ -52,9 +79,9 @@ module.exports = { } ``` -## Tests +## Learn More -To learn more about `tsd` tests and assertions see the [documentation](https://github.com/SamVerschueren/tsd). +To learn more about `tsd` and its assertions see the [documentation](https://github.com/SamVerschueren/tsd). ## License From a47145065367a529a455da3fc073976cfb4c093e Mon Sep 17 00:00:00 2001 From: mrazauskas <72159681+mrazauskas@users.noreply.github.com> Date: Fri, 14 Jan 2022 19:36:36 +0200 Subject: [PATCH 09/19] bump tsd-lite --- package.json | 2 +- yarn.lock | 10 +++++----- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/package.json b/package.json index ab53a34..e325541 100644 --- a/package.json +++ b/package.json @@ -32,7 +32,7 @@ "@babel/code-frame": "^7.15.8", "chalk": "^4.1.2", "create-jest-runner": "^0.9.0", - "tsd-lite": "^0.2.0" + "tsd-lite": "^0.3.0" }, "devDependencies": { "@babel/core": "^7.15.8", diff --git a/yarn.lock b/yarn.lock index 6dfb2b1..741cde1 100644 --- a/yarn.lock +++ b/yarn.lock @@ -3968,7 +3968,7 @@ fsevents@^2.3.2: execa: ^5.1.1 jest: ^27.2.5 prettier: ^2.4.1 - tsd-lite: ^0.2.0 + tsd-lite: ^0.3.0 typescript: ^4.4.4 peerDependencies: "@tsd/typescript": ^3.8.3 || ^4.0.7 @@ -5554,12 +5554,12 @@ fsevents@^2.3.2: languageName: node linkType: hard -"tsd-lite@npm:^0.2.0": - version: 0.2.0 - resolution: "tsd-lite@npm:0.2.0" +"tsd-lite@npm:^0.3.0": + version: 0.3.0 + resolution: "tsd-lite@npm:0.3.0" peerDependencies: "@tsd/typescript": ^3.8.3 || ^4.0.7 - checksum: 4bd2b883cda48bea22225bceadfd268511e143a9c9d6a86e8e8a6d7ef9e5b055a6046b2e7348cbb6a7739297d84f75ca227d81966599ff62c1c12c6d12eea8df + checksum: 327bd343020ea3265e585d0ab977fab1274baddfb862b76fa22710babefb0a12f91a89bae1ada795455d72e53eda826872c2d91b7931d22e687813113ccc88fd languageName: node linkType: hard From 6e237c08117a50e6113dd484286be3505cb7d414 Mon Sep 17 00:00:00 2001 From: mrazauskas <72159681+mrazauskas@users.noreply.github.com> Date: Fri, 14 Jan 2022 19:44:57 +0200 Subject: [PATCH 10/19] fix test --- e2e/__snapshots__/errors.test.ts.snap | 2 +- package.json | 2 +- yarn.lock | 10 +++++----- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/e2e/__snapshots__/errors.test.ts.snap b/e2e/__snapshots__/errors.test.ts.snap index ff1ca0f..c1bbb2a 100644 --- a/e2e/__snapshots__/errors.test.ts.snap +++ b/e2e/__snapshots__/errors.test.ts.snap @@ -3,7 +3,7 @@ exports[`throws if nearest tsconfig.json is not valid 1`] = ` "FAIL e2e/__fixtures__/errors-tsconfig/index.test.ts ● Test suite failed to run - Argument for '--module' option must be: 'none', 'commonjs', 'amd', 'system', 'umd', 'es6', 'es2015', 'es2020', 'esnext'. + Argument for '--module' option must be: 'none', 'commonjs', 'amd', 'system', 'umd', 'es6', 'es2015', 'es2020', 'es2022', 'esnext', 'node12', 'nodenext'. > 3 | \\"module\\": \\"random\\", | ^ at e2e/__fixtures__/errors-tsconfig/tsconfig.json:3:15 diff --git a/package.json b/package.json index e325541..bccf193 100644 --- a/package.json +++ b/package.json @@ -38,7 +38,7 @@ "@babel/core": "^7.15.8", "@babel/preset-env": "^7.15.8", "@babel/preset-typescript": "^7.15.0", - "@tsd/typescript": "^4.4.4", + "@tsd/typescript": "^4.5.4", "@typescript-eslint/eslint-plugin": "^4.33.0", "@typescript-eslint/parser": "^4.33.0", "babel-jest": "^27.2.5", diff --git a/yarn.lock b/yarn.lock index 741cde1..3071208 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1627,13 +1627,13 @@ __metadata: languageName: node linkType: hard -"@tsd/typescript@npm:4.4.4": - version: 4.4.4 - resolution: "@tsd/typescript@npm:4.4.4" +"@tsd/typescript@npm:^4.5.4": + version: 4.5.4 + resolution: "@tsd/typescript@npm:4.5.4" bin: tsc: typescript/bin/tsc tsserver: typescript/bin/tsserver - checksum: 3f1d69f12917f1e685b4cc15eba18b4d000e076092aff27228d6d47a631d2267c431914cf1061d2d5d052112d5a74071830a568e0a396a0aa6e608fb30b016f0 + checksum: 7f81f8c627a11a46512fe555f7d8006921a468ccf4324c0b457fe26281b478cd6d416684a5d94e458dfab0f614a1c21f68c4421b087f415fd4653662d4138115 languageName: node linkType: hard @@ -3956,7 +3956,7 @@ fsevents@^2.3.2: "@babel/core": ^7.15.8 "@babel/preset-env": ^7.15.8 "@babel/preset-typescript": ^7.15.0 - "@tsd/typescript": ^4.4.4 + "@tsd/typescript": ^4.5.4 "@typescript-eslint/eslint-plugin": ^4.33.0 "@typescript-eslint/parser": ^4.33.0 babel-jest: ^27.2.5 From 5127b361660169a1aa93ab77d564062662715283 Mon Sep 17 00:00:00 2001 From: mrazauskas <72159681+mrazauskas@users.noreply.github.com> Date: Fri, 14 Jan 2022 20:09:24 +0200 Subject: [PATCH 11/19] refactor formatter --- e2e/__snapshots__/errors.test.ts.snap | 8 ++++---- src/formatter.js | 29 +++++++++++++++------------ 2 files changed, 20 insertions(+), 17 deletions(-) diff --git a/e2e/__snapshots__/errors.test.ts.snap b/e2e/__snapshots__/errors.test.ts.snap index c1bbb2a..b351f5c 100644 --- a/e2e/__snapshots__/errors.test.ts.snap +++ b/e2e/__snapshots__/errors.test.ts.snap @@ -6,11 +6,11 @@ exports[`throws if nearest tsconfig.json is not valid 1`] = ` Argument for '--module' option must be: 'none', 'commonjs', 'amd', 'system', 'umd', 'es6', 'es2015', 'es2020', 'es2022', 'esnext', 'node12', 'nodenext'. > 3 | \\"module\\": \\"random\\", | ^ - at e2e/__fixtures__/errors-tsconfig/tsconfig.json:3:15 + at e2e/__fixtures__/errors-tsconfig/tsconfig.json:3:15 Compiler option 'strict' requires a value of type boolean. > 5 | \\"strict\\": \\"yes\\", | ^ - at e2e/__fixtures__/errors-tsconfig/tsconfig.json:5:15 + at e2e/__fixtures__/errors-tsconfig/tsconfig.json:5:15 Test Suites: 1 failed, 1 total Tests: 0 total Snapshots: 0 total @@ -25,11 +25,11 @@ exports[`throws if syntax error is encountered 1`] = ` SyntaxError: ')' expected. > 4 | expectError(one('foo', 'bar'); | ^ - at e2e/__fixtures__/errors-syntax/index.test.ts:4:30 + at e2e/__fixtures__/errors-syntax/index.test.ts:4:30 SyntaxError: ',' expected. > 5 | expectError(one('foo' 'bar')); | ^ - at e2e/__fixtures__/errors-syntax/index.test.ts:5:23 + at e2e/__fixtures__/errors-syntax/index.test.ts:5:23 Test Suites: 1 failed, 1 total Tests: 0 total Snapshots: 0 total diff --git a/src/formatter.js b/src/formatter.js index 5acf243..62aa5a9 100644 --- a/src/formatter.js +++ b/src/formatter.js @@ -38,18 +38,18 @@ function getCodeFrameAndLocation(file, start) { chalk.cyan(normalizeSlashes(relative('', file.fileName))) + chalk.dim(':' + (line + 1) + ':' + (character + 1)); - return { codeFrame, location }; + return [codeFrame, indentEachLine(location, 1)].join('\n\n'); } module.exports.formatTsdErrors = tsdErrors => { const messages = tsdErrors.map(error => { if (error.file) { - const { codeFrame, location } = getCodeFrameAndLocation( + const codeFrameAndLocation = getCodeFrameAndLocation( error.file, error.start ); - return [error.message, codeFrame, location].join('\n\n'); + return [error.message, codeFrameAndLocation].join('\n\n'); } return error.message; @@ -62,16 +62,19 @@ module.exports.formatTsdResults = tsdResults => { const title = chalk.bold.red(makeTitle('tsd typecheck')); const messages = tsdResults.map(result => { - const { codeFrame, location } = getCodeFrameAndLocation( - result.file, - result.start - ); - - return [ - indentEachLine(result.message, 2), - indentEachLine(codeFrame, 2), - indentEachLine(location, 3), - ].join('\n\n'); + if (result.file) { + const codeFrameAndLocation = getCodeFrameAndLocation( + result.file, + result.start + ); + + return [ + indentEachLine(result.message, 2), + indentEachLine(codeFrameAndLocation, 2), + ].join('\n\n'); + } + + return indentEachLine(result.message, 2); }); return [title, messages.join('\n\n'), ''].join('\n'); From 710fcb6ea1467033d156ccdec591da9e6080affe Mon Sep 17 00:00:00 2001 From: mrazauskas <72159681+mrazauskas@users.noreply.github.com> Date: Sat, 15 Jan 2022 10:24:33 +0200 Subject: [PATCH 12/19] add showConfig hint --- README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/README.md b/README.md index 72d91f5..b0f43de 100644 --- a/README.md +++ b/README.md @@ -46,6 +46,8 @@ To compile each test file, `tsd-lite` will read the nearest [`tsconfig.json`](ht For example, if your project already includes a `tsconfig.json` in the root directory, but you prefer to have different configuration for testing, simply add another `tsconfig.json` to a directory with the test files. It may override or extend your root configuration. +**Hint:** run `yarn tsc -p path/to/__typetests__ --showConfig` to print the configuration which applies to the test files. + **Note:** if `tsconfig.json` is not found, the compiler will fall back to the default configuration. ### Optionally Strict From 81c8d27151e57981bcb67f8e00f3bb607ddb81ef Mon Sep 17 00:00:00 2001 From: mrazauskas <72159681+mrazauskas@users.noreply.github.com> Date: Sat, 15 Jan 2022 10:27:48 +0200 Subject: [PATCH 13/19] lets stick with typescript 4.4.4 --- e2e/__snapshots__/errors.test.ts.snap | 2 +- package.json | 4 ++-- yarn.lock | 24 ++++++++++++------------ 3 files changed, 15 insertions(+), 15 deletions(-) diff --git a/e2e/__snapshots__/errors.test.ts.snap b/e2e/__snapshots__/errors.test.ts.snap index b351f5c..86be903 100644 --- a/e2e/__snapshots__/errors.test.ts.snap +++ b/e2e/__snapshots__/errors.test.ts.snap @@ -3,7 +3,7 @@ exports[`throws if nearest tsconfig.json is not valid 1`] = ` "FAIL e2e/__fixtures__/errors-tsconfig/index.test.ts ● Test suite failed to run - Argument for '--module' option must be: 'none', 'commonjs', 'amd', 'system', 'umd', 'es6', 'es2015', 'es2020', 'es2022', 'esnext', 'node12', 'nodenext'. + Argument for '--module' option must be: 'none', 'commonjs', 'amd', 'system', 'umd', 'es6', 'es2015', 'es2020', 'esnext'. > 3 | \\"module\\": \\"random\\", | ^ at e2e/__fixtures__/errors-tsconfig/tsconfig.json:3:15 diff --git a/package.json b/package.json index bccf193..120b3c5 100644 --- a/package.json +++ b/package.json @@ -38,7 +38,7 @@ "@babel/core": "^7.15.8", "@babel/preset-env": "^7.15.8", "@babel/preset-typescript": "^7.15.0", - "@tsd/typescript": "^4.5.4", + "@tsd/typescript": "~4.4.4", "@typescript-eslint/eslint-plugin": "^4.33.0", "@typescript-eslint/parser": "^4.33.0", "babel-jest": "^27.2.5", @@ -48,7 +48,7 @@ "execa": "^5.1.1", "jest": "^27.2.5", "prettier": "^2.4.1", - "typescript": "^4.4.4" + "typescript": "~4.4.4" }, "peerDependencies": { "@tsd/typescript": "^3.8.3 || ^4.0.7" diff --git a/yarn.lock b/yarn.lock index 3071208..ac2c1b2 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1627,13 +1627,13 @@ __metadata: languageName: node linkType: hard -"@tsd/typescript@npm:^4.5.4": - version: 4.5.4 - resolution: "@tsd/typescript@npm:4.5.4" +"@tsd/typescript@npm:~4.4.4": + version: 4.4.4 + resolution: "@tsd/typescript@npm:4.4.4" bin: tsc: typescript/bin/tsc tsserver: typescript/bin/tsserver - checksum: 7f81f8c627a11a46512fe555f7d8006921a468ccf4324c0b457fe26281b478cd6d416684a5d94e458dfab0f614a1c21f68c4421b087f415fd4653662d4138115 + checksum: 3f1d69f12917f1e685b4cc15eba18b4d000e076092aff27228d6d47a631d2267c431914cf1061d2d5d052112d5a74071830a568e0a396a0aa6e608fb30b016f0 languageName: node linkType: hard @@ -3956,7 +3956,7 @@ fsevents@^2.3.2: "@babel/core": ^7.15.8 "@babel/preset-env": ^7.15.8 "@babel/preset-typescript": ^7.15.0 - "@tsd/typescript": ^4.5.4 + "@tsd/typescript": ~4.4.4 "@typescript-eslint/eslint-plugin": ^4.33.0 "@typescript-eslint/parser": ^4.33.0 babel-jest: ^27.2.5 @@ -3969,7 +3969,7 @@ fsevents@^2.3.2: jest: ^27.2.5 prettier: ^2.4.1 tsd-lite: ^0.3.0 - typescript: ^4.4.4 + typescript: ~4.4.4 peerDependencies: "@tsd/typescript": ^3.8.3 || ^4.0.7 languageName: unknown @@ -5629,23 +5629,23 @@ fsevents@^2.3.2: languageName: node linkType: hard -typescript@^4.4.4: +"typescript@patch:typescript@~4.4.4#builtin": version: 4.4.4 - resolution: "typescript@npm:4.4.4" + resolution: "typescript@patch:typescript@npm%3A4.4.4#builtin::version=4.4.4&hash=8133ad" bin: tsc: bin/tsc tsserver: bin/tsserver - checksum: 8c5455b860a69f05d4730f54bcd0c380dae34bb1ae1b0d6ac5f16fb9d3c445834dff563eccc8c970cd15e7c9d2aa8183851a0d35d62bac1e24260bf805c23af4 + checksum: d1c6c0a705893112dc19979fa58dd96b1b9395bf4cb9b013bdfe4badb31320c39187f2ff6088568e6742b66624c1bcf49c8d7ef1f443fbd64d4225752c09f065 languageName: node linkType: hard -"typescript@patch:typescript@^4.4.4#builtin": +typescript@~4.4.4: version: 4.4.4 - resolution: "typescript@patch:typescript@npm%3A4.4.4#builtin::version=4.4.4&hash=8133ad" + resolution: "typescript@npm:4.4.4" bin: tsc: bin/tsc tsserver: bin/tsserver - checksum: d1c6c0a705893112dc19979fa58dd96b1b9395bf4cb9b013bdfe4badb31320c39187f2ff6088568e6742b66624c1bcf49c8d7ef1f443fbd64d4225752c09f065 + checksum: 8c5455b860a69f05d4730f54bcd0c380dae34bb1ae1b0d6ac5f16fb9d3c445834dff563eccc8c970cd15e7c9d2aa8183851a0d35d62bac1e24260bf805c23af4 languageName: node linkType: hard From f7d4c0e760f737f93e2ebca26aaff5f143e1d30e Mon Sep 17 00:00:00 2001 From: mrazauskas <72159681+mrazauskas@users.noreply.github.com> Date: Sat, 15 Jan 2022 10:52:59 +0200 Subject: [PATCH 14/19] remove unnecessary async --- src/run.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/run.js b/src/run.js index f237b59..774032b 100644 --- a/src/run.js +++ b/src/run.js @@ -5,7 +5,7 @@ const { pass } = require('./pass'); const TEST_TITLE = 'tsd typecheck'; -module.exports = async ({ testPath }) => { +module.exports = ({ testPath }) => { const start = Date.now(); const { assertionsCount, tsdErrors, tsdResults } = tsdLite.default(testPath); From 4258f96c06f9eacd35a500c5e7943de586ad3b34 Mon Sep 17 00:00:00 2001 From: mrazauskas <72159681+mrazauskas@users.noreply.github.com> Date: Mon, 17 Jan 2022 11:54:33 +0200 Subject: [PATCH 15/19] bump tsd-lite --- package.json | 2 +- yarn.lock | 10 +++++----- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/package.json b/package.json index 120b3c5..4562e6d 100644 --- a/package.json +++ b/package.json @@ -32,7 +32,7 @@ "@babel/code-frame": "^7.15.8", "chalk": "^4.1.2", "create-jest-runner": "^0.9.0", - "tsd-lite": "^0.3.0" + "tsd-lite": "^0.4.0" }, "devDependencies": { "@babel/core": "^7.15.8", diff --git a/yarn.lock b/yarn.lock index ac2c1b2..f34b00e 100644 --- a/yarn.lock +++ b/yarn.lock @@ -3968,7 +3968,7 @@ fsevents@^2.3.2: execa: ^5.1.1 jest: ^27.2.5 prettier: ^2.4.1 - tsd-lite: ^0.3.0 + tsd-lite: ^0.4.0 typescript: ~4.4.4 peerDependencies: "@tsd/typescript": ^3.8.3 || ^4.0.7 @@ -5554,12 +5554,12 @@ fsevents@^2.3.2: languageName: node linkType: hard -"tsd-lite@npm:^0.3.0": - version: 0.3.0 - resolution: "tsd-lite@npm:0.3.0" +"tsd-lite@npm:^0.4.0": + version: 0.4.0 + resolution: "tsd-lite@npm:0.4.0" peerDependencies: "@tsd/typescript": ^3.8.3 || ^4.0.7 - checksum: 327bd343020ea3265e585d0ab977fab1274baddfb862b76fa22710babefb0a12f91a89bae1ada795455d72e53eda826872c2d91b7931d22e687813113ccc88fd + checksum: 5d2adccef41e8e7f340153ce8a64c19d478e15074b9ef49af0892bc2e300fcf75c3f6d514cf0aa2e395ec91b38813e8da64989ddb11823822e1338759eb077c3 languageName: node linkType: hard From 6ec1dc1ca3cb5826790a1bd40b5f5b93eee63402 Mon Sep 17 00:00:00 2001 From: mrazauskas <72159681+mrazauskas@users.noreply.github.com> Date: Mon, 17 Jan 2022 11:55:07 +0200 Subject: [PATCH 16/19] much better errors --- .../errors-tsconfig/tsconfig.json | 2 +- e2e/__snapshots__/errors.test.ts.snap | 23 ++++++------ src/formatter.js | 36 +++++-------------- src/run.js | 10 ++---- 4 files changed, 23 insertions(+), 48 deletions(-) diff --git a/e2e/__fixtures__/errors-tsconfig/tsconfig.json b/e2e/__fixtures__/errors-tsconfig/tsconfig.json index 3ab3096..d5b8d32 100644 --- a/e2e/__fixtures__/errors-tsconfig/tsconfig.json +++ b/e2e/__fixtures__/errors-tsconfig/tsconfig.json @@ -1,6 +1,6 @@ { "compilerOptions": { - "module": "random", + "module": "commonjs", "target": "es2019", "strict": "yes", "noEmitOnError": true diff --git a/e2e/__snapshots__/errors.test.ts.snap b/e2e/__snapshots__/errors.test.ts.snap index 86be903..9970cf6 100644 --- a/e2e/__snapshots__/errors.test.ts.snap +++ b/e2e/__snapshots__/errors.test.ts.snap @@ -3,14 +3,15 @@ exports[`throws if nearest tsconfig.json is not valid 1`] = ` "FAIL e2e/__fixtures__/errors-tsconfig/index.test.ts ● Test suite failed to run - Argument for '--module' option must be: 'none', 'commonjs', 'amd', 'system', 'umd', 'es6', 'es2015', 'es2020', 'esnext'. - > 3 | \\"module\\": \\"random\\", - | ^ - at e2e/__fixtures__/errors-tsconfig/tsconfig.json:3:15 - Compiler option 'strict' requires a value of type boolean. + ConfigError: Compiler option 'strict' requires a value of type boolean. + 3 | \\"module\\": \\"commonjs\\", + 4 | \\"target\\": \\"es2019\\", > 5 | \\"strict\\": \\"yes\\", | ^ - at e2e/__fixtures__/errors-tsconfig/tsconfig.json:5:15 + 6 | \\"noEmitOnError\\": true + 7 | }, + 8 | \\"include\\": [\\"./**/*\\"] + at tsconfig.json:5:15 Test Suites: 1 failed, 1 total Tests: 0 total Snapshots: 0 total @@ -23,13 +24,13 @@ exports[`throws if syntax error is encountered 1`] = ` "FAIL e2e/__fixtures__/errors-syntax/index.test.ts ● Test suite failed to run SyntaxError: ')' expected. + 2 | import one from '.'; + 3 | > 4 | expectError(one('foo', 'bar'); | ^ - at e2e/__fixtures__/errors-syntax/index.test.ts:4:30 - SyntaxError: ',' expected. - > 5 | expectError(one('foo' 'bar')); - | ^ - at e2e/__fixtures__/errors-syntax/index.test.ts:5:23 + 5 | expectError(one('foo' 'bar')); + 6 | + at index.test.ts:4:30 Test Suites: 1 failed, 1 total Tests: 0 total Snapshots: 0 total diff --git a/src/formatter.js b/src/formatter.js index 62aa5a9..fa298ee 100644 --- a/src/formatter.js +++ b/src/formatter.js @@ -1,5 +1,6 @@ const { posix, relative, sep } = require('path'); const { codeFrameColumns } = require('@babel/code-frame'); +const ts = require('@tsd/typescript'); const chalk = require('chalk'); const NOT_EMPTY_LINE_REGEXP = /^(?!$)/gm; @@ -41,40 +42,19 @@ function getCodeFrameAndLocation(file, start) { return [codeFrame, indentEachLine(location, 1)].join('\n\n'); } -module.exports.formatTsdErrors = tsdErrors => { - const messages = tsdErrors.map(error => { - if (error.file) { - const codeFrameAndLocation = getCodeFrameAndLocation( - error.file, - error.start - ); - - return [error.message, codeFrameAndLocation].join('\n\n'); - } - - return error.message; - }); - - return messages.join('\n\n'); -}; - module.exports.formatTsdResults = tsdResults => { const title = chalk.bold.red(makeTitle('tsd typecheck')); const messages = tsdResults.map(result => { - if (result.file) { - const codeFrameAndLocation = getCodeFrameAndLocation( - result.file, - result.start - ); + const message = ts.flattenDiagnosticMessageText(result.messageText, '\n'); - return [ - indentEachLine(result.message, 2), - indentEachLine(codeFrameAndLocation, 2), - ].join('\n\n'); - } + const codeFrameAndLocation = result.file + ? getCodeFrameAndLocation(result.file, result.start) + : undefined; - return indentEachLine(result.message, 2); + return [indentEachLine(message, 2), indentEachLine(codeFrameAndLocation, 2)] + .filter(line => line !== undefined) + .join('\n\n'); }); return [title, messages.join('\n\n'), ''].join('\n'); diff --git a/src/run.js b/src/run.js index 774032b..8a255dc 100644 --- a/src/run.js +++ b/src/run.js @@ -1,5 +1,5 @@ const tsdLite = require('tsd-lite'); -const { formatTsdErrors, formatTsdResults } = require('./formatter'); +const { formatTsdResults } = require('./formatter'); const { fail } = require('./fail'); const { pass } = require('./pass'); @@ -8,16 +8,10 @@ const TEST_TITLE = 'tsd typecheck'; module.exports = ({ testPath }) => { const start = Date.now(); - const { assertionsCount, tsdErrors, tsdResults } = tsdLite.default(testPath); + const { assertionsCount, tsdResults } = tsdLite.default(testPath); const end = Date.now(); - if (tsdErrors !== undefined) { - const message = formatTsdErrors(tsdErrors); - - throw { message, stack: '' }; - } - const numFailed = tsdResults.length; const numPassed = assertionsCount - numFailed; From 11de4767a644b2b4802e21e5e03f40126a0f19b7 Mon Sep 17 00:00:00 2001 From: mrazauskas <72159681+mrazauskas@users.noreply.github.com> Date: Fri, 4 Feb 2022 10:18:51 +0200 Subject: [PATCH 17/19] bump tsd-lite --- e2e/__snapshots__/failing.test.ts.snap | 8 ++++---- package.json | 2 +- yarn.lock | 10 +++++----- 3 files changed, 10 insertions(+), 10 deletions(-) diff --git a/e2e/__snapshots__/failing.test.ts.snap b/e2e/__snapshots__/failing.test.ts.snap index bec8b9b..d757de6 100644 --- a/e2e/__snapshots__/failing.test.ts.snap +++ b/e2e/__snapshots__/failing.test.ts.snap @@ -6,8 +6,8 @@ exports[`works with failing JS test 1`] = ` ● tsd typecheck Argument of type 'number' is not assignable to parameter of type 'string'. > 5 | expectType(concat(1, 2)); - | ^ - at e2e/__fixtures__/js-failing/index.test.ts:5:20 + | ^ + at e2e/__fixtures__/js-failing/index.test.ts:5:1 Test Suites: 1 failed, 1 total Tests: 1 failed, 1 passed, 2 total Snapshots: 0 total @@ -22,8 +22,8 @@ exports[`works with failing TS test 1`] = ` ● tsd typecheck Argument of type 'Date' is not assignable to parameter of type 'string'. > 5 | expectType(makeDate(5, 5, 5)); - | ^ - at e2e/__fixtures__/ts-failing/index.test.ts:5:20 + | ^ + at e2e/__fixtures__/ts-failing/index.test.ts:5:1 Expected an error, but found none. > 7 | expectError(makeDate(1, 3, 6)); | ^ diff --git a/package.json b/package.json index 4562e6d..efc4343 100644 --- a/package.json +++ b/package.json @@ -32,7 +32,7 @@ "@babel/code-frame": "^7.15.8", "chalk": "^4.1.2", "create-jest-runner": "^0.9.0", - "tsd-lite": "^0.4.0" + "tsd-lite": "^0.5.0" }, "devDependencies": { "@babel/core": "^7.15.8", diff --git a/yarn.lock b/yarn.lock index f34b00e..b9f0579 100644 --- a/yarn.lock +++ b/yarn.lock @@ -3968,7 +3968,7 @@ fsevents@^2.3.2: execa: ^5.1.1 jest: ^27.2.5 prettier: ^2.4.1 - tsd-lite: ^0.4.0 + tsd-lite: ^0.5.0 typescript: ~4.4.4 peerDependencies: "@tsd/typescript": ^3.8.3 || ^4.0.7 @@ -5554,12 +5554,12 @@ fsevents@^2.3.2: languageName: node linkType: hard -"tsd-lite@npm:^0.4.0": - version: 0.4.0 - resolution: "tsd-lite@npm:0.4.0" +"tsd-lite@npm:^0.5.0": + version: 0.5.0 + resolution: "tsd-lite@npm:0.5.0" peerDependencies: "@tsd/typescript": ^3.8.3 || ^4.0.7 - checksum: 5d2adccef41e8e7f340153ce8a64c19d478e15074b9ef49af0892bc2e300fcf75c3f6d514cf0aa2e395ec91b38813e8da64989ddb11823822e1338759eb077c3 + checksum: 6590ca24f2ac07e961ec3786a94269c26bfa93b09c3d397f5f3c3b09fedee515dbe96aa09de4c24ce3a42a3bbe47543f0a30aa06770b34b4a6eb8b61e92dce21 languageName: node linkType: hard From 3725bafb8c4900f4d01db81d3d7afe822a945efd Mon Sep 17 00:00:00 2001 From: mrazauskas <72159681+mrazauskas@users.noreply.github.com> Date: Fri, 4 Feb 2022 10:19:57 +0200 Subject: [PATCH 18/19] tweak readme --- README.md | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index b0f43de..8da5cce 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -# jest-runner-tsd +# `jest-runner-tsd` > Run your TypeScript type tests using Jest. @@ -17,15 +17,19 @@ Most important differences (for the full list see [`tsd-lite` repo](https://gith ```bash yarn add -D jest-runner-tsd @tsd/typescript +# or +npm install --save-dev jest-runner-tsd @tsd/typescript ``` Remember to install `@tsd/typescript` package. It is a required peer dependency. +Note that `@tsd/typescript` will be used to compile type tests. Generally it is recommended to match versions of `@tsd/typescript` and `typescript` in a project, but you may choose to test on different version too. + ## Configuration ### Jest -First of all, you should [configure Jest](https://jestjs.io/docs/configuration) to discover your test files. For example, if the files are suffix with `.test.ts` and live inside `__typetests__` directory, set up `jest.config.tsd.js` like this: +First of all, you should [configure Jest](https://jestjs.io/docs/configuration) to discover your test files. For example, if the files have `.test.ts` suffix and live inside `__typetests__` directories, set up `jest.config.tsd.js` like this: ```js module.exports = { @@ -40,7 +44,7 @@ module.exports = { ### TS Compiler -Your test files will be compiled using the [TypeScript compiler](https://github.com/microsoft/TypeScript/wiki/Using-the-Compiler-API) (similarly to `tsc`), but, instead of emitting JS code, `tsd-lite` will analyze types and diagnostics returned by the compiler. +Your test files will be compiled using the [TypeScript compiler](https://github.com/microsoft/TypeScript/wiki/Using-the-Compiler-API) (similar to `tsc`), but, instead of emitting JS code, `tsd-lite` will analyze types and diagnostics returned by the compiler. To compile each test file, `tsd-lite` will read the nearest [`tsconfig.json`](https://www.typescriptlang.org/docs/handbook/tsconfig-json.html) and will pass the configuration to the compiler. Hence, you may have a configuration for the whole project, or a group of test files, or just a particular test file. From 6218a2ce2e65c9d6ac58b1cfdcc9277bb6cd014f Mon Sep 17 00:00:00 2001 From: Simen Bekkhus Date: Fri, 4 Feb 2022 10:35:55 +0100 Subject: [PATCH 19/19] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 8da5cce..6da89f4 100644 --- a/README.md +++ b/README.md @@ -16,7 +16,7 @@ Most important differences (for the full list see [`tsd-lite` repo](https://gith ## Install ```bash -yarn add -D jest-runner-tsd @tsd/typescript +yarn add --dev jest-runner-tsd @tsd/typescript # or npm install --save-dev jest-runner-tsd @tsd/typescript ```