diff --git a/CHANGELOG.md b/CHANGELOG.md index c20e4d2a0c4d..9c516b2995e3 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -59,6 +59,7 @@ ### Features - `[jest]` Expose `Config` type ([#12848](https://github.com/facebook/jest/pull/12848)) +- `[jest]` Allow enabling Jest global types through `"types": ["jest"]` in `tsconfig.json` ([#12856](https://github.com/facebook/jest/pull/12856)) - `[@jest/reporters]` Improve `GitHubActionsReporter`s annotation format ([#12826](https://github.com/facebook/jest/pull/12826)) - `[@jest/types]` Infer argument types passed to `test` and `describe` callback functions from `each` tables ([#12885](https://github.com/facebook/jest/pull/12885), [#12905](https://github.com/facebook/jest/pull/12905)) diff --git a/docs/ExpectAPI.md b/docs/ExpectAPI.md index aa25136d861b..8674c26c3aab 100644 --- a/docs/ExpectAPI.md +++ b/docs/ExpectAPI.md @@ -7,6 +7,12 @@ When you're writing tests, you often need to check that values meet certain cond For additional Jest matchers maintained by the Jest Community check out [`jest-extended`](https://github.com/jest-community/jest-extended). +:::info + +The TypeScript examples from this page assume you are using type definitions from [`jest`](GettingStarted.md/#type-definitions). + +::: + ## Methods import TOCInline from '@theme/TOCInline'; @@ -37,29 +43,104 @@ The argument to `expect` should be the value that your code produces, and any ar You can use `expect.extend` to add your own matchers to Jest. For example, let's say that you're testing a number utility library and you're frequently asserting that numbers appear within particular ranges of other numbers. You could abstract that into a `toBeWithinRange` matcher: -```js +```js tab +const toBeWithinRange = function (actual, floor, ceiling) { + if ( + typeof actual !== 'number' || + typeof floor !== 'number' || + typeof ceiling !== 'number' + ) { + throw new Error('These must be of type number!'); + } + + const pass = actual >= floor && actual <= ceiling; + if (pass) { + return { + message: () => + `expected ${this.utils.printReceived( + actual, + )} not to be within range ${this.utils.printExpected( + `${floor} - ${ceiling}`, + )}`, + pass: true, + }; + } else { + return { + message: () => + `expected ${this.utils.printReceived( + actual, + )} to be within range ${this.utils.printExpected( + `${floor} - ${ceiling}`, + )}`, + pass: false, + }; + } +}; + expect.extend({ - toBeWithinRange(received, floor, ceiling) { - const pass = received >= floor && received <= ceiling; + toBeWithinRange, +}); +``` + +```ts tab +import type {MatcherFunction} from 'expect'; + +const toBeWithinRange: MatcherFunction<[floor: number, ceiling: number]> = + function (actual: unknown, floor: unknown, ceiling: unknown) { + if ( + typeof actual !== 'number' || + typeof floor !== 'number' || + typeof ceiling !== 'number' + ) { + throw new Error('These must be of type number!'); + } + + const pass = actual >= floor && actual <= ceiling; if (pass) { return { message: () => - `expected ${received} not to be within range ${floor} - ${ceiling}`, + `expected ${this.utils.printReceived( + actual, + )} not to be within range ${this.utils.printExpected( + `${floor} - ${ceiling}`, + )}`, pass: true, }; } else { return { message: () => - `expected ${received} to be within range ${floor} - ${ceiling}`, + `expected ${this.utils.printReceived( + actual, + )} to be within range ${this.utils.printExpected( + `${floor} - ${ceiling}`, + )}`, pass: false, }; } - }, + }; + +expect.extend({ + toBeWithinRange, }); +declare module 'expect' { + interface AsymmetricMatchers { + toBeWithinRange(floor: number, ceiling: number): void; + } + interface Matchers { + toBeWithinRange(floor: number, ceiling: number): R; + } +} +``` + +And use it in a test: + +```js test('numeric ranges', () => { expect(100).toBeWithinRange(90, 110); + expect(101).not.toBeWithinRange(0, 100); + expect({apples: 6, bananas: 3}).toEqual({ apples: expect.toBeWithinRange(1, 10), bananas: expect.not.toBeWithinRange(11, 20), @@ -67,26 +148,6 @@ test('numeric ranges', () => { }); ``` -:::note - -In TypeScript, when using `@types/jest` for example, you can declare the new `toBeWithinRange` matcher in the imported module like this: - -```ts -interface CustomMatchers { - toBeWithinRange(floor: number, ceiling: number): R; -} - -declare global { - namespace jest { - interface Expect extends CustomMatchers {} - interface Matchers extends CustomMatchers {} - interface InverseAsymmetricMatchers extends CustomMatchers {} - } -} -``` - -::: - #### Async Matchers `expect.extend` also supports async matchers. Async matchers return a Promise so you will need to await the returned value. Let's use an example matcher to illustrate the usage of them. We are going to implement a matcher called `toBeDivisibleByExternalValue`, where the divisible number is going to be pulled from an external source. diff --git a/docs/GettingStarted.md b/docs/GettingStarted.md index 870942cac091..870e7ccb08f0 100644 --- a/docs/GettingStarted.md +++ b/docs/GettingStarted.md @@ -156,10 +156,31 @@ npm install --save-dev ts-jest #### Type definitions -You may also want to install the [`@types/jest`](https://www.npmjs.com/package/@types/jest) module for the version of Jest you're using. This will help provide full typing when writing your tests with TypeScript. +To enable type definitions of [Jest globals](GlobalAPI.md) add `"jest"` to the `"types"` list of your `tsconfig.json`: -> For `@types/*` modules it's recommended to try to match the version of the associated module. For example, if you are using `26.4.0` of `jest` then using `26.4.x` of `@types/jest` is ideal. In general, try to match the major (`26`) and minor (`4`) version as closely as possible. +```json title="tsconfig.json" +{ + "compilerOptions": { + "types": ["jest"] + } +} +``` -```bash npm2yarn -npm install --save-dev @types/jest +Alternatively you may use explicit imports from `@jest/globals` package: + +```ts title="sum.test.ts" +import {describe, expect, test} from '@jest/globals'; +import {sum} from './sum'; + +describe('sum module', () => { + test('adds 1 + 2 to equal 3', () => { + expect(sum(1, 2)).toBe(3); + }); +}); ``` + +:::info + +If you had `@types/jest` installed in your project before, remember to remove it. + +::: diff --git a/docs/GlobalAPI.md b/docs/GlobalAPI.md index ad68f1389c15..486eca22f70a 100644 --- a/docs/GlobalAPI.md +++ b/docs/GlobalAPI.md @@ -939,11 +939,7 @@ test.todo('add should be associative'); :::info -These TypeScript usage tips and caveats are only applicable if you import from `'@jest/globals'`: - -```ts -import {describe, test} from '@jest/globals'; -``` +The TypeScript examples from this page assume you are using type definitions from [`jest`](GettingStarted.md/#type-definitions). ::: diff --git a/docs/MockFunctionAPI.md b/docs/MockFunctionAPI.md index 526110167a84..45e45299aa90 100644 --- a/docs/MockFunctionAPI.md +++ b/docs/MockFunctionAPI.md @@ -7,11 +7,7 @@ Mock functions are also known as "spies", because they let you spy on the behavi :::info -The TypeScript examples from this page will only work as documented if you import `jest` from `'@jest/globals'`: - -```ts -import {jest} from '@jest/globals'; -``` +The TypeScript examples from this page assume you are using type definitions from [`jest`](GettingStarted.md/#type-definitions). ::: diff --git a/docs/UpgradingToJest29.md b/docs/UpgradingToJest29.md index 89dacba4beca..b0970cf951dd 100644 --- a/docs/UpgradingToJest29.md +++ b/docs/UpgradingToJest29.md @@ -50,9 +50,20 @@ Exports of `Mocked*` utility types from `jest-mock` package have changed. `Maybe ## TypeScript +From Jest 29 you can replace `@types/jest` package with native type definitions. Simply add `"jest"` to the `"types"` list of your `tsconfig.json` and enjoy typed testing! + +```diff title="tsconfig.json" + { + "compilerOptions": { +- "types": ["@types/jest"] ++ "types": ["jest"] + } + } +``` + :::info -The TypeScript examples from this page will only work as documented if you import `jest` from `'@jest/globals'`: +The TypeScript examples below assume you are using type definitions from `jest` and not `@types/jest`. ```ts import {jest} from '@jest/globals'; diff --git a/e2e/tsconfig.json b/e2e/tsconfig.json index a25747da2a2d..b4c805fbba53 100644 --- a/e2e/tsconfig.json +++ b/e2e/tsconfig.json @@ -1,22 +1,8 @@ { + "extends": "../tsconfig.json", "compilerOptions": { - "noEmit": true, - - "target": "es2017", - "module": "commonjs", - "lib": ["dom", "es2017"], - "strict": true, - - /* Additional Checks */ - "noUnusedLocals": true, - "noUnusedParameters": true, - "noImplicitReturns": true, - "noFallthroughCasesInSwitch": true, - - /* Module Resolution Options */ - "moduleResolution": "node", - "isolatedModules": true, - "importsNotUsedAsValues": "error", - "resolveJsonModule": true - } + "composite": false, + "types": ["jest"] + }, + "include": ["../**/*"] } diff --git a/examples/angular/package.json b/examples/angular/package.json index d7e38c7293e0..08a27b348a13 100644 --- a/examples/angular/package.json +++ b/examples/angular/package.json @@ -23,7 +23,6 @@ "@babel/plugin-proposal-decorators": "*", "@babel/preset-env": "^7.1.0", "@babel/preset-typescript": "^7.0.0", - "@types/jest": "^27.4.0", "babel-jest": "workspace:*", "babel-plugin-transform-typescript-metadata": "*", "jest": "workspace:*", diff --git a/examples/expect-extend/__tests__/ranges.test.ts b/examples/expect-extend/__tests__/ranges.test.ts index 77f80e8a5ef8..1faaac9ba8ec 100644 --- a/examples/expect-extend/__tests__/ranges.test.ts +++ b/examples/expect-extend/__tests__/ranges.test.ts @@ -5,7 +5,6 @@ * LICENSE file in the root directory of this source tree. */ -import {expect, test} from '@jest/globals'; import '../toBeWithinRange'; test('is within range', () => expect(100).toBeWithinRange(90, 110)); diff --git a/examples/expect-extend/toBeWithinRange.ts b/examples/expect-extend/toBeWithinRange.ts index 43be8cfe431a..feb5e42c093e 100644 --- a/examples/expect-extend/toBeWithinRange.ts +++ b/examples/expect-extend/toBeWithinRange.ts @@ -5,7 +5,6 @@ * LICENSE file in the root directory of this source tree. */ -import {expect} from '@jest/globals'; import type {MatcherFunction} from 'expect'; const toBeWithinRange: MatcherFunction<[floor: number, ceiling: number]> = diff --git a/examples/expect-extend/tsconfig.json b/examples/expect-extend/tsconfig.json index 3b5a9204b389..a1e0c2ef1d68 100644 --- a/examples/expect-extend/tsconfig.json +++ b/examples/expect-extend/tsconfig.json @@ -1,6 +1,7 @@ { "compilerOptions": { - "strict": true + "strict": true, + "types": ["jest"] }, "include": ["./**/*"] } diff --git a/examples/typescript/package.json b/examples/typescript/package.json index 938f9aa1698c..3cbf67cbc0c3 100644 --- a/examples/typescript/package.json +++ b/examples/typescript/package.json @@ -12,7 +12,6 @@ "@babel/preset-env": "^7.1.0", "@babel/preset-react": "^7.12.1", "@babel/preset-typescript": "^7.0.0", - "@types/jest": "^27.4.0", "babel-jest": "workspace:*", "jest": "workspace:*" }, diff --git a/examples/typescript/tsconfig.json b/examples/typescript/tsconfig.json index 2d2d665710bc..56cfce46578a 100644 --- a/examples/typescript/tsconfig.json +++ b/examples/typescript/tsconfig.json @@ -1,6 +1,7 @@ { "compilerOptions": { "module": "commonjs", - "jsx": "react-jsx" + "jsx": "react-jsx", + "types": ["jest"] } } diff --git a/package.json b/package.json index 3ca1a9b20c78..79232d60e54c 100644 --- a/package.json +++ b/package.json @@ -20,7 +20,6 @@ "@types/babel__generator": "^7.0.0", "@types/babel__template": "^7.0.2", "@types/dedent": "^0.7.0", - "@types/jest": "^27.4.0", "@types/node": "~14.14.45", "@types/which": "^2.0.0", "@typescript-eslint/eslint-plugin": "^5.14.0", diff --git a/packages/babel-jest/src/__tests__/tsconfig.json b/packages/babel-jest/src/__tests__/tsconfig.json new file mode 100644 index 000000000000..21a4fe83bc20 --- /dev/null +++ b/packages/babel-jest/src/__tests__/tsconfig.json @@ -0,0 +1,10 @@ +{ + "extends": "../../../../tsconfig.json", + "compilerOptions": { + "composite": false, + "esModuleInterop": true, + "rootDir": "../", + "types": ["jest"] + }, + "include": ["../**/*"] +} diff --git a/packages/babel-plugin-jest-hoist/src/__tests__/tsconfig.json b/packages/babel-plugin-jest-hoist/src/__tests__/tsconfig.json new file mode 100644 index 000000000000..21a4fe83bc20 --- /dev/null +++ b/packages/babel-plugin-jest-hoist/src/__tests__/tsconfig.json @@ -0,0 +1,10 @@ +{ + "extends": "../../../../tsconfig.json", + "compilerOptions": { + "composite": false, + "esModuleInterop": true, + "rootDir": "../", + "types": ["jest"] + }, + "include": ["../**/*"] +} diff --git a/packages/diff-sequences/src/__tests__/tsconfig.json b/packages/diff-sequences/src/__tests__/tsconfig.json new file mode 100644 index 000000000000..21a4fe83bc20 --- /dev/null +++ b/packages/diff-sequences/src/__tests__/tsconfig.json @@ -0,0 +1,10 @@ +{ + "extends": "../../../../tsconfig.json", + "compilerOptions": { + "composite": false, + "esModuleInterop": true, + "rootDir": "../", + "types": ["jest"] + }, + "include": ["../**/*"] +} diff --git a/packages/expect-utils/src/__tests__/tsconfig.json b/packages/expect-utils/src/__tests__/tsconfig.json new file mode 100644 index 000000000000..21a4fe83bc20 --- /dev/null +++ b/packages/expect-utils/src/__tests__/tsconfig.json @@ -0,0 +1,10 @@ +{ + "extends": "../../../../tsconfig.json", + "compilerOptions": { + "composite": false, + "esModuleInterop": true, + "rootDir": "../", + "types": ["jest"] + }, + "include": ["../**/*"] +} diff --git a/packages/expect/src/__tests__/tsconfig.json b/packages/expect/src/__tests__/tsconfig.json new file mode 100644 index 000000000000..21a4fe83bc20 --- /dev/null +++ b/packages/expect/src/__tests__/tsconfig.json @@ -0,0 +1,10 @@ +{ + "extends": "../../../../tsconfig.json", + "compilerOptions": { + "composite": false, + "esModuleInterop": true, + "rootDir": "../", + "types": ["jest"] + }, + "include": ["../**/*"] +} diff --git a/packages/jest-circus/src/__tests__/tsconfig.json b/packages/jest-circus/src/__tests__/tsconfig.json new file mode 100644 index 000000000000..21a4fe83bc20 --- /dev/null +++ b/packages/jest-circus/src/__tests__/tsconfig.json @@ -0,0 +1,10 @@ +{ + "extends": "../../../../tsconfig.json", + "compilerOptions": { + "composite": false, + "esModuleInterop": true, + "rootDir": "../", + "types": ["jest"] + }, + "include": ["../**/*"] +} diff --git a/packages/jest-circus/tsconfig.json b/packages/jest-circus/tsconfig.json index 67941a37790e..5722ca1d21ac 100644 --- a/packages/jest-circus/tsconfig.json +++ b/packages/jest-circus/tsconfig.json @@ -2,9 +2,7 @@ "extends": "../../tsconfig", "compilerOptions": { "outDir": "build", - "rootDir": "src", - // we don't want `@types/jest` to be referenced - "types": [] + "rootDir": "src" }, "include": ["./src/**/*"], "exclude": ["./**/__mocks__/**/*", "./**/__tests__/**/*"], diff --git a/packages/jest-cli/src/__tests__/tsconfig.json b/packages/jest-cli/src/__tests__/tsconfig.json new file mode 100644 index 000000000000..21a4fe83bc20 --- /dev/null +++ b/packages/jest-cli/src/__tests__/tsconfig.json @@ -0,0 +1,10 @@ +{ + "extends": "../../../../tsconfig.json", + "compilerOptions": { + "composite": false, + "esModuleInterop": true, + "rootDir": "../", + "types": ["jest"] + }, + "include": ["../**/*"] +} diff --git a/packages/jest-cli/src/init/__tests__/tsconfig.json b/packages/jest-cli/src/init/__tests__/tsconfig.json new file mode 100644 index 000000000000..e2776c3e444f --- /dev/null +++ b/packages/jest-cli/src/init/__tests__/tsconfig.json @@ -0,0 +1,10 @@ +{ + "extends": "../../../../../tsconfig.json", + "compilerOptions": { + "composite": false, + "esModuleInterop": true, + "rootDir": "../", + "types": ["jest"] + }, + "include": ["../**/*"] +} diff --git a/packages/jest-config/src/__tests__/tsconfig.json b/packages/jest-config/src/__tests__/tsconfig.json new file mode 100644 index 000000000000..21a4fe83bc20 --- /dev/null +++ b/packages/jest-config/src/__tests__/tsconfig.json @@ -0,0 +1,10 @@ +{ + "extends": "../../../../tsconfig.json", + "compilerOptions": { + "composite": false, + "esModuleInterop": true, + "rootDir": "../", + "types": ["jest"] + }, + "include": ["../**/*"] +} diff --git a/packages/jest-console/src/__tests__/tsconfig.json b/packages/jest-console/src/__tests__/tsconfig.json new file mode 100644 index 000000000000..21a4fe83bc20 --- /dev/null +++ b/packages/jest-console/src/__tests__/tsconfig.json @@ -0,0 +1,10 @@ +{ + "extends": "../../../../tsconfig.json", + "compilerOptions": { + "composite": false, + "esModuleInterop": true, + "rootDir": "../", + "types": ["jest"] + }, + "include": ["../**/*"] +} diff --git a/packages/jest-core/src/__tests__/tsconfig.json b/packages/jest-core/src/__tests__/tsconfig.json new file mode 100644 index 000000000000..21a4fe83bc20 --- /dev/null +++ b/packages/jest-core/src/__tests__/tsconfig.json @@ -0,0 +1,10 @@ +{ + "extends": "../../../../tsconfig.json", + "compilerOptions": { + "composite": false, + "esModuleInterop": true, + "rootDir": "../", + "types": ["jest"] + }, + "include": ["../**/*"] +} diff --git a/packages/jest-core/src/lib/__tests__/tsconfig.json b/packages/jest-core/src/lib/__tests__/tsconfig.json new file mode 100644 index 000000000000..aa4d0b76cee8 --- /dev/null +++ b/packages/jest-core/src/lib/__tests__/tsconfig.json @@ -0,0 +1,10 @@ +{ + "extends": "../../../../../tsconfig.json", + "compilerOptions": { + "composite": false, + "esModuleInterop": true, + "rootDir": "../../", + "types": ["jest"] + }, + "include": ["../**/*"] +} diff --git a/packages/jest-core/src/plugins/__tests__/tsconfig.json b/packages/jest-core/src/plugins/__tests__/tsconfig.json new file mode 100644 index 000000000000..aa4d0b76cee8 --- /dev/null +++ b/packages/jest-core/src/plugins/__tests__/tsconfig.json @@ -0,0 +1,10 @@ +{ + "extends": "../../../../../tsconfig.json", + "compilerOptions": { + "composite": false, + "esModuleInterop": true, + "rootDir": "../../", + "types": ["jest"] + }, + "include": ["../**/*"] +} diff --git a/packages/jest-create-cache-key-function/src/__tests__/tsconfig.json b/packages/jest-create-cache-key-function/src/__tests__/tsconfig.json new file mode 100644 index 000000000000..21a4fe83bc20 --- /dev/null +++ b/packages/jest-create-cache-key-function/src/__tests__/tsconfig.json @@ -0,0 +1,10 @@ +{ + "extends": "../../../../tsconfig.json", + "compilerOptions": { + "composite": false, + "esModuleInterop": true, + "rootDir": "../", + "types": ["jest"] + }, + "include": ["../**/*"] +} diff --git a/packages/jest-diff/src/__tests__/tsconfig.json b/packages/jest-diff/src/__tests__/tsconfig.json new file mode 100644 index 000000000000..21a4fe83bc20 --- /dev/null +++ b/packages/jest-diff/src/__tests__/tsconfig.json @@ -0,0 +1,10 @@ +{ + "extends": "../../../../tsconfig.json", + "compilerOptions": { + "composite": false, + "esModuleInterop": true, + "rootDir": "../", + "types": ["jest"] + }, + "include": ["../**/*"] +} diff --git a/packages/jest-docblock/src/__tests__/tsconfig.json b/packages/jest-docblock/src/__tests__/tsconfig.json new file mode 100644 index 000000000000..21a4fe83bc20 --- /dev/null +++ b/packages/jest-docblock/src/__tests__/tsconfig.json @@ -0,0 +1,10 @@ +{ + "extends": "../../../../tsconfig.json", + "compilerOptions": { + "composite": false, + "esModuleInterop": true, + "rootDir": "../", + "types": ["jest"] + }, + "include": ["../**/*"] +} diff --git a/packages/jest-each/src/__tests__/tsconfig.json b/packages/jest-each/src/__tests__/tsconfig.json new file mode 100644 index 000000000000..21a4fe83bc20 --- /dev/null +++ b/packages/jest-each/src/__tests__/tsconfig.json @@ -0,0 +1,10 @@ +{ + "extends": "../../../../tsconfig.json", + "compilerOptions": { + "composite": false, + "esModuleInterop": true, + "rootDir": "../", + "types": ["jest"] + }, + "include": ["../**/*"] +} diff --git a/packages/jest-environment-jsdom/src/__tests__/tsconfig.json b/packages/jest-environment-jsdom/src/__tests__/tsconfig.json new file mode 100644 index 000000000000..21a4fe83bc20 --- /dev/null +++ b/packages/jest-environment-jsdom/src/__tests__/tsconfig.json @@ -0,0 +1,10 @@ +{ + "extends": "../../../../tsconfig.json", + "compilerOptions": { + "composite": false, + "esModuleInterop": true, + "rootDir": "../", + "types": ["jest"] + }, + "include": ["../**/*"] +} diff --git a/packages/jest-environment-node/src/__tests__/tsconfig.json b/packages/jest-environment-node/src/__tests__/tsconfig.json new file mode 100644 index 000000000000..21a4fe83bc20 --- /dev/null +++ b/packages/jest-environment-node/src/__tests__/tsconfig.json @@ -0,0 +1,10 @@ +{ + "extends": "../../../../tsconfig.json", + "compilerOptions": { + "composite": false, + "esModuleInterop": true, + "rootDir": "../", + "types": ["jest"] + }, + "include": ["../**/*"] +} diff --git a/packages/jest-environment/tsconfig.json b/packages/jest-environment/tsconfig.json index 3b0f77d1c9c5..4ac228a90ddf 100644 --- a/packages/jest-environment/tsconfig.json +++ b/packages/jest-environment/tsconfig.json @@ -1,8 +1,6 @@ { "extends": "../../tsconfig.json", "compilerOptions": { - // we don't want `@types/jest` to be referenced - "types": ["node"], "rootDir": "src", "outDir": "build" }, diff --git a/packages/jest-fake-timers/src/__tests__/tsconfig.json b/packages/jest-fake-timers/src/__tests__/tsconfig.json new file mode 100644 index 000000000000..21a4fe83bc20 --- /dev/null +++ b/packages/jest-fake-timers/src/__tests__/tsconfig.json @@ -0,0 +1,10 @@ +{ + "extends": "../../../../tsconfig.json", + "compilerOptions": { + "composite": false, + "esModuleInterop": true, + "rootDir": "../", + "types": ["jest"] + }, + "include": ["../**/*"] +} diff --git a/packages/jest-get-type/src/__tests__/tsconfig.json b/packages/jest-get-type/src/__tests__/tsconfig.json new file mode 100644 index 000000000000..21a4fe83bc20 --- /dev/null +++ b/packages/jest-get-type/src/__tests__/tsconfig.json @@ -0,0 +1,10 @@ +{ + "extends": "../../../../tsconfig.json", + "compilerOptions": { + "composite": false, + "esModuleInterop": true, + "rootDir": "../", + "types": ["jest"] + }, + "include": ["../**/*"] +} diff --git a/packages/jest-globals/src/__tests__/tsconfig.json b/packages/jest-globals/src/__tests__/tsconfig.json new file mode 100644 index 000000000000..21a4fe83bc20 --- /dev/null +++ b/packages/jest-globals/src/__tests__/tsconfig.json @@ -0,0 +1,10 @@ +{ + "extends": "../../../../tsconfig.json", + "compilerOptions": { + "composite": false, + "esModuleInterop": true, + "rootDir": "../", + "types": ["jest"] + }, + "include": ["../**/*"] +} diff --git a/packages/jest-globals/tsconfig.json b/packages/jest-globals/tsconfig.json index 90f222531f6b..06c39bed1061 100644 --- a/packages/jest-globals/tsconfig.json +++ b/packages/jest-globals/tsconfig.json @@ -1,8 +1,6 @@ { "extends": "../../tsconfig.json", "compilerOptions": { - // we don't want `@types/jest` to be referenced - "types": [], "rootDir": "src", "outDir": "build" }, diff --git a/packages/jest-haste-map/src/__tests__/tsconfig.json b/packages/jest-haste-map/src/__tests__/tsconfig.json new file mode 100644 index 000000000000..21a4fe83bc20 --- /dev/null +++ b/packages/jest-haste-map/src/__tests__/tsconfig.json @@ -0,0 +1,10 @@ +{ + "extends": "../../../../tsconfig.json", + "compilerOptions": { + "composite": false, + "esModuleInterop": true, + "rootDir": "../", + "types": ["jest"] + }, + "include": ["../**/*"] +} diff --git a/packages/jest-haste-map/src/crawlers/__tests__/tsconfig.json b/packages/jest-haste-map/src/crawlers/__tests__/tsconfig.json new file mode 100644 index 000000000000..aa4d0b76cee8 --- /dev/null +++ b/packages/jest-haste-map/src/crawlers/__tests__/tsconfig.json @@ -0,0 +1,10 @@ +{ + "extends": "../../../../../tsconfig.json", + "compilerOptions": { + "composite": false, + "esModuleInterop": true, + "rootDir": "../../", + "types": ["jest"] + }, + "include": ["../**/*"] +} diff --git a/packages/jest-haste-map/src/lib/__tests__/tsconfig.json b/packages/jest-haste-map/src/lib/__tests__/tsconfig.json new file mode 100644 index 000000000000..aa4d0b76cee8 --- /dev/null +++ b/packages/jest-haste-map/src/lib/__tests__/tsconfig.json @@ -0,0 +1,10 @@ +{ + "extends": "../../../../../tsconfig.json", + "compilerOptions": { + "composite": false, + "esModuleInterop": true, + "rootDir": "../../", + "types": ["jest"] + }, + "include": ["../**/*"] +} diff --git a/packages/jest-jasmine2/src/__tests__/tsconfig.json b/packages/jest-jasmine2/src/__tests__/tsconfig.json new file mode 100644 index 000000000000..21a4fe83bc20 --- /dev/null +++ b/packages/jest-jasmine2/src/__tests__/tsconfig.json @@ -0,0 +1,10 @@ +{ + "extends": "../../../../tsconfig.json", + "compilerOptions": { + "composite": false, + "esModuleInterop": true, + "rootDir": "../", + "types": ["jest"] + }, + "include": ["../**/*"] +} diff --git a/packages/jest-jasmine2/tsconfig.json b/packages/jest-jasmine2/tsconfig.json index 3d2268f04774..ecd8d01247bf 100644 --- a/packages/jest-jasmine2/tsconfig.json +++ b/packages/jest-jasmine2/tsconfig.json @@ -2,9 +2,7 @@ "extends": "../../tsconfig", "compilerOptions": { "rootDir": "src", - "outDir": "build", - // we don't want `@types/jest` to be referenced - "types": [] + "outDir": "build" }, "include": ["./src/**/*"], "exclude": ["./**/__tests__/**/*"], diff --git a/packages/jest-leak-detector/src/__tests__/tsconfig.json b/packages/jest-leak-detector/src/__tests__/tsconfig.json new file mode 100644 index 000000000000..21a4fe83bc20 --- /dev/null +++ b/packages/jest-leak-detector/src/__tests__/tsconfig.json @@ -0,0 +1,10 @@ +{ + "extends": "../../../../tsconfig.json", + "compilerOptions": { + "composite": false, + "esModuleInterop": true, + "rootDir": "../", + "types": ["jest"] + }, + "include": ["../**/*"] +} diff --git a/packages/jest-matcher-utils/src/__tests__/tsconfig.json b/packages/jest-matcher-utils/src/__tests__/tsconfig.json new file mode 100644 index 000000000000..21a4fe83bc20 --- /dev/null +++ b/packages/jest-matcher-utils/src/__tests__/tsconfig.json @@ -0,0 +1,10 @@ +{ + "extends": "../../../../tsconfig.json", + "compilerOptions": { + "composite": false, + "esModuleInterop": true, + "rootDir": "../", + "types": ["jest"] + }, + "include": ["../**/*"] +} diff --git a/packages/jest-message-util/src/__tests__/tsconfig.json b/packages/jest-message-util/src/__tests__/tsconfig.json new file mode 100644 index 000000000000..21a4fe83bc20 --- /dev/null +++ b/packages/jest-message-util/src/__tests__/tsconfig.json @@ -0,0 +1,10 @@ +{ + "extends": "../../../../tsconfig.json", + "compilerOptions": { + "composite": false, + "esModuleInterop": true, + "rootDir": "../", + "types": ["jest"] + }, + "include": ["../**/*"] +} diff --git a/packages/jest-mock/src/__tests__/tsconfig.json b/packages/jest-mock/src/__tests__/tsconfig.json new file mode 100644 index 000000000000..21a4fe83bc20 --- /dev/null +++ b/packages/jest-mock/src/__tests__/tsconfig.json @@ -0,0 +1,10 @@ +{ + "extends": "../../../../tsconfig.json", + "compilerOptions": { + "composite": false, + "esModuleInterop": true, + "rootDir": "../", + "types": ["jest"] + }, + "include": ["../**/*"] +} diff --git a/packages/jest-regex-util/src/__tests__/tsconfig.json b/packages/jest-regex-util/src/__tests__/tsconfig.json new file mode 100644 index 000000000000..21a4fe83bc20 --- /dev/null +++ b/packages/jest-regex-util/src/__tests__/tsconfig.json @@ -0,0 +1,10 @@ +{ + "extends": "../../../../tsconfig.json", + "compilerOptions": { + "composite": false, + "esModuleInterop": true, + "rootDir": "../", + "types": ["jest"] + }, + "include": ["../**/*"] +} diff --git a/packages/jest-repl/src/__tests__/tsconfig.json b/packages/jest-repl/src/__tests__/tsconfig.json new file mode 100644 index 000000000000..21a4fe83bc20 --- /dev/null +++ b/packages/jest-repl/src/__tests__/tsconfig.json @@ -0,0 +1,10 @@ +{ + "extends": "../../../../tsconfig.json", + "compilerOptions": { + "composite": false, + "esModuleInterop": true, + "rootDir": "../", + "types": ["jest"] + }, + "include": ["../**/*"] +} diff --git a/packages/jest-reporters/src/__tests__/tsconfig.json b/packages/jest-reporters/src/__tests__/tsconfig.json new file mode 100644 index 000000000000..21a4fe83bc20 --- /dev/null +++ b/packages/jest-reporters/src/__tests__/tsconfig.json @@ -0,0 +1,10 @@ +{ + "extends": "../../../../tsconfig.json", + "compilerOptions": { + "composite": false, + "esModuleInterop": true, + "rootDir": "../", + "types": ["jest"] + }, + "include": ["../**/*"] +} diff --git a/packages/jest-resolve-dependencies/src/__tests__/tsconfig.json b/packages/jest-resolve-dependencies/src/__tests__/tsconfig.json new file mode 100644 index 000000000000..21a4fe83bc20 --- /dev/null +++ b/packages/jest-resolve-dependencies/src/__tests__/tsconfig.json @@ -0,0 +1,10 @@ +{ + "extends": "../../../../tsconfig.json", + "compilerOptions": { + "composite": false, + "esModuleInterop": true, + "rootDir": "../", + "types": ["jest"] + }, + "include": ["../**/*"] +} diff --git a/packages/jest-resolve/src/__tests__/tsconfig.json b/packages/jest-resolve/src/__tests__/tsconfig.json new file mode 100644 index 000000000000..21a4fe83bc20 --- /dev/null +++ b/packages/jest-resolve/src/__tests__/tsconfig.json @@ -0,0 +1,10 @@ +{ + "extends": "../../../../tsconfig.json", + "compilerOptions": { + "composite": false, + "esModuleInterop": true, + "rootDir": "../", + "types": ["jest"] + }, + "include": ["../**/*"] +} diff --git a/packages/jest-runner/src/__tests__/tsconfig.json b/packages/jest-runner/src/__tests__/tsconfig.json new file mode 100644 index 000000000000..21a4fe83bc20 --- /dev/null +++ b/packages/jest-runner/src/__tests__/tsconfig.json @@ -0,0 +1,10 @@ +{ + "extends": "../../../../tsconfig.json", + "compilerOptions": { + "composite": false, + "esModuleInterop": true, + "rootDir": "../", + "types": ["jest"] + }, + "include": ["../**/*"] +} diff --git a/packages/jest-runtime/src/__tests__/tsconfig.json b/packages/jest-runtime/src/__tests__/tsconfig.json new file mode 100644 index 000000000000..21a4fe83bc20 --- /dev/null +++ b/packages/jest-runtime/src/__tests__/tsconfig.json @@ -0,0 +1,10 @@ +{ + "extends": "../../../../tsconfig.json", + "compilerOptions": { + "composite": false, + "esModuleInterop": true, + "rootDir": "../", + "types": ["jest"] + }, + "include": ["../**/*"] +} diff --git a/packages/jest-snapshot/src/__tests__/tsconfig.json b/packages/jest-snapshot/src/__tests__/tsconfig.json new file mode 100644 index 000000000000..21a4fe83bc20 --- /dev/null +++ b/packages/jest-snapshot/src/__tests__/tsconfig.json @@ -0,0 +1,10 @@ +{ + "extends": "../../../../tsconfig.json", + "compilerOptions": { + "composite": false, + "esModuleInterop": true, + "rootDir": "../", + "types": ["jest"] + }, + "include": ["../**/*"] +} diff --git a/packages/jest-source-map/src/__tests__/tsconfig.json b/packages/jest-source-map/src/__tests__/tsconfig.json new file mode 100644 index 000000000000..21a4fe83bc20 --- /dev/null +++ b/packages/jest-source-map/src/__tests__/tsconfig.json @@ -0,0 +1,10 @@ +{ + "extends": "../../../../tsconfig.json", + "compilerOptions": { + "composite": false, + "esModuleInterop": true, + "rootDir": "../", + "types": ["jest"] + }, + "include": ["../**/*"] +} diff --git a/packages/jest-test-result/src/__tests__/tsconfig.json b/packages/jest-test-result/src/__tests__/tsconfig.json new file mode 100644 index 000000000000..21a4fe83bc20 --- /dev/null +++ b/packages/jest-test-result/src/__tests__/tsconfig.json @@ -0,0 +1,10 @@ +{ + "extends": "../../../../tsconfig.json", + "compilerOptions": { + "composite": false, + "esModuleInterop": true, + "rootDir": "../", + "types": ["jest"] + }, + "include": ["../**/*"] +} diff --git a/packages/jest-test-sequencer/src/__tests__/tsconfig.json b/packages/jest-test-sequencer/src/__tests__/tsconfig.json new file mode 100644 index 000000000000..21a4fe83bc20 --- /dev/null +++ b/packages/jest-test-sequencer/src/__tests__/tsconfig.json @@ -0,0 +1,10 @@ +{ + "extends": "../../../../tsconfig.json", + "compilerOptions": { + "composite": false, + "esModuleInterop": true, + "rootDir": "../", + "types": ["jest"] + }, + "include": ["../**/*"] +} diff --git a/packages/jest-transform/src/__tests__/tsconfig.json b/packages/jest-transform/src/__tests__/tsconfig.json new file mode 100644 index 000000000000..21a4fe83bc20 --- /dev/null +++ b/packages/jest-transform/src/__tests__/tsconfig.json @@ -0,0 +1,10 @@ +{ + "extends": "../../../../tsconfig.json", + "compilerOptions": { + "composite": false, + "esModuleInterop": true, + "rootDir": "../", + "types": ["jest"] + }, + "include": ["../**/*"] +} diff --git a/packages/jest-util/src/__tests__/tsconfig.json b/packages/jest-util/src/__tests__/tsconfig.json new file mode 100644 index 000000000000..21a4fe83bc20 --- /dev/null +++ b/packages/jest-util/src/__tests__/tsconfig.json @@ -0,0 +1,10 @@ +{ + "extends": "../../../../tsconfig.json", + "compilerOptions": { + "composite": false, + "esModuleInterop": true, + "rootDir": "../", + "types": ["jest"] + }, + "include": ["../**/*"] +} diff --git a/packages/jest-validate/src/__tests__/tsconfig.json b/packages/jest-validate/src/__tests__/tsconfig.json new file mode 100644 index 000000000000..21a4fe83bc20 --- /dev/null +++ b/packages/jest-validate/src/__tests__/tsconfig.json @@ -0,0 +1,10 @@ +{ + "extends": "../../../../tsconfig.json", + "compilerOptions": { + "composite": false, + "esModuleInterop": true, + "rootDir": "../", + "types": ["jest"] + }, + "include": ["../**/*"] +} diff --git a/packages/jest-watcher/src/lib/__tests__/tsconfig.json b/packages/jest-watcher/src/lib/__tests__/tsconfig.json new file mode 100644 index 000000000000..9efa3a46dfe2 --- /dev/null +++ b/packages/jest-watcher/src/lib/__tests__/tsconfig.json @@ -0,0 +1,10 @@ +{ + "extends": "../../../../../tsconfig.json", + "compilerOptions": { + "composite": false, + "esModuleInterop": true, + "rootDir": "../../", + "types": ["jest"] + }, + "include": ["../../**/*"] +} diff --git a/packages/jest-worker/src/__tests__/tsconfig.json b/packages/jest-worker/src/__tests__/tsconfig.json new file mode 100644 index 000000000000..21a4fe83bc20 --- /dev/null +++ b/packages/jest-worker/src/__tests__/tsconfig.json @@ -0,0 +1,10 @@ +{ + "extends": "../../../../tsconfig.json", + "compilerOptions": { + "composite": false, + "esModuleInterop": true, + "rootDir": "../", + "types": ["jest"] + }, + "include": ["../**/*"] +} diff --git a/packages/jest-worker/src/base/__tests__/tsconfig.json b/packages/jest-worker/src/base/__tests__/tsconfig.json new file mode 100644 index 000000000000..aa4d0b76cee8 --- /dev/null +++ b/packages/jest-worker/src/base/__tests__/tsconfig.json @@ -0,0 +1,10 @@ +{ + "extends": "../../../../../tsconfig.json", + "compilerOptions": { + "composite": false, + "esModuleInterop": true, + "rootDir": "../../", + "types": ["jest"] + }, + "include": ["../**/*"] +} diff --git a/packages/jest-worker/src/workers/__tests__/tsconfig.json b/packages/jest-worker/src/workers/__tests__/tsconfig.json new file mode 100644 index 000000000000..aa4d0b76cee8 --- /dev/null +++ b/packages/jest-worker/src/workers/__tests__/tsconfig.json @@ -0,0 +1,10 @@ +{ + "extends": "../../../../../tsconfig.json", + "compilerOptions": { + "composite": false, + "esModuleInterop": true, + "rootDir": "../../", + "types": ["jest"] + }, + "include": ["../**/*"] +} diff --git a/packages/jest/__typetests__/jest.test.ts b/packages/jest/__typetests__/jest.test.ts index 82ed8518fe3e..9819c40bb545 100644 --- a/packages/jest/__typetests__/jest.test.ts +++ b/packages/jest/__typetests__/jest.test.ts @@ -6,9 +6,98 @@ */ import {expectType} from 'tsd-lite'; -import type {Config as ConfigTypes} from '@jest/types'; +import type {Jest} from '@jest/environment'; +import type {JestExpect} from '@jest/expect'; +import type {Config as ConfigTypes, Global} from '@jest/types'; import type {Config} from 'jest'; +import type { + Mocked, + MockedClass, + MockedFunction, + MockedObject, +} from 'jest-mock'; + +// Config declare const config: Config; expectType(config); + +// globals enabled through "types": ["jest"] + +class SomeClass { + constructor(one: string, two?: boolean) {} + + methodA() { + return true; + } + methodB(a: string, b?: number) { + return; + } +} + +function someFunction(a: string, b?: number): boolean { + return true; +} + +const someObject = { + SomeClass, + + methodA() { + return; + }, + methodB(b: string) { + return true; + }, + methodC: (c: number) => true, + + one: { + more: { + time: (t: number) => { + return; + }, + }, + }, + + propertyA: 123, + propertyB: 'value', + + someClassInstance: new SomeClass('value'), +}; + +expectType(beforeEach); +expectType(beforeAll); + +expectType(afterEach); +expectType(afterAll); + +expectType(describe); +expectType(fdescribe); +expectType(xdescribe); + +expectType(test); +expectType(xtest); + +expectType(it); +expectType(fit); +expectType(xit); + +expectType(expect); + +expectType(jest); + +expectType>( + someObject as jest.Mocked, +); + +expectType>( + SomeClass as jest.MockedClass, +); + +expectType>( + someFunction as jest.MockedFunction, +); + +expectType>( + someObject as jest.MockedObject, +); diff --git a/packages/jest/__typetests__/tsconfig.json b/packages/jest/__typetests__/tsconfig.json index 165ba1343021..bb887a2b4cf7 100644 --- a/packages/jest/__typetests__/tsconfig.json +++ b/packages/jest/__typetests__/tsconfig.json @@ -6,7 +6,7 @@ "noUnusedParameters": false, "skipLibCheck": true, - "types": [] + "types": ["jest"] }, "include": ["./**/*"] } diff --git a/packages/jest/package.json b/packages/jest/package.json index c8679e60f948..e4b03b31dd9e 100644 --- a/packages/jest/package.json +++ b/packages/jest/package.json @@ -14,9 +14,11 @@ }, "dependencies": { "@jest/core": "workspace:^", + "@jest/globals": "workspace:^", "@jest/types": "workspace:^", "import-local": "^3.0.2", - "jest-cli": "workspace:^" + "jest-cli": "workspace:^", + "jest-mock": "workspace:^" }, "devDependencies": { "@tsd/typescript": "~4.7.4", diff --git a/packages/jest/src/index.ts b/packages/jest/src/index.ts index 415c7a7ffa47..3c9d18fdfe7a 100644 --- a/packages/jest/src/index.ts +++ b/packages/jest/src/index.ts @@ -6,6 +6,14 @@ */ import type {Config as ConfigTypes} from '@jest/types'; +import type { + ClassLike, + FunctionLike, + Mocked as JestMocked, + MockedClass as JestMockedClass, + MockedFunction as JestMockedFunction, + MockedObject as JestMockedObject, +} from 'jest-mock'; export { SearchSource, @@ -17,3 +25,46 @@ export { export {run} from 'jest-cli'; export type Config = ConfigTypes.InitialOptions; + +declare global { + export const beforeEach: typeof import('@jest/globals')['beforeEach']; + export const beforeAll: typeof import('@jest/globals')['beforeAll']; + + export const afterEach: typeof import('@jest/globals')['afterEach']; + export const afterAll: typeof import('@jest/globals')['afterAll']; + + export const describe: typeof import('@jest/globals')['describe']; + export const fdescribe: typeof import('@jest/globals')['fdescribe']; + export const xdescribe: typeof import('@jest/globals')['xdescribe']; + + export const test: typeof import('@jest/globals')['test']; + export const xtest: typeof import('@jest/globals')['xtest']; + + export const it: typeof import('@jest/globals')['it']; + export const fit: typeof import('@jest/globals')['fit']; + export const xit: typeof import('@jest/globals')['xit']; + + export const expect: typeof import('@jest/globals')['expect']; + + export const jest: typeof import('@jest/globals')['jest']; + + // eslint-disable-next-line @typescript-eslint/no-namespace + namespace jest { + /** + * Wraps a class, function or object type with Jest mock type definitions. + */ + export type Mocked = JestMocked; + /** + * Wraps a class type with Jest mock type definitions. + */ + export type MockedClass = JestMockedClass; + /** + * Wraps a function type with Jest mock type definitions. + */ + export type MockedFunction = JestMockedFunction; + /** + * Wraps an object type with Jest mock type definitions. + */ + export type MockedObject = JestMockedObject; + } +} diff --git a/packages/jest/tsconfig.json b/packages/jest/tsconfig.json index 454abee9f0e8..9c5eebd3c8cf 100644 --- a/packages/jest/tsconfig.json +++ b/packages/jest/tsconfig.json @@ -8,6 +8,8 @@ "references": [ {"path": "../jest-cli"}, {"path": "../jest-core"}, + {"path": "../jest-globals"}, + {"path": "../jest-mock"}, {"path": "../jest-types"} ] } diff --git a/packages/pretty-format/src/__tests__/setPrettyPrint.ts b/packages/pretty-format/src/__tests__/setPrettyPrint.ts index 5317d89f9cce..e82ce4f9b87e 100644 --- a/packages/pretty-format/src/__tests__/setPrettyPrint.ts +++ b/packages/pretty-format/src/__tests__/setPrettyPrint.ts @@ -8,12 +8,9 @@ import prettyFormat from '../'; import type {OptionsReceived, Plugins} from '../types'; -declare global { - // eslint-disable-next-line @typescript-eslint/no-namespace - namespace jest { - interface Matchers { - toPrettyPrintTo(expected: unknown, options?: OptionsReceived): R; - } +declare module 'expect' { + interface Matchers { + toPrettyPrintTo(expected: unknown, options?: OptionsReceived): R; } } diff --git a/packages/pretty-format/src/__tests__/tsconfig.json b/packages/pretty-format/src/__tests__/tsconfig.json new file mode 100644 index 000000000000..21a4fe83bc20 --- /dev/null +++ b/packages/pretty-format/src/__tests__/tsconfig.json @@ -0,0 +1,10 @@ +{ + "extends": "../../../../tsconfig.json", + "compilerOptions": { + "composite": false, + "esModuleInterop": true, + "rootDir": "../", + "types": ["jest"] + }, + "include": ["../**/*"] +} diff --git a/packages/test-utils/src/ConditionalTest.ts b/packages/test-utils/src/ConditionalTest.ts index 53e1f965e969..badcb0c10ada 100644 --- a/packages/test-utils/src/ConditionalTest.ts +++ b/packages/test-utils/src/ConditionalTest.ts @@ -5,9 +5,11 @@ * LICENSE file in the root directory of this source tree. */ -/* eslint-disable jest/no-focused-tests */ - import semver = require('semver'); +import type {Global} from '@jest/types'; + +declare const describe: Global.TestFrameworkGlobals['describe']; +declare const test: Global.TestFrameworkGlobals['test']; export function isJestJasmineRun(): boolean { return process.env.JEST_JASMINE === '1'; diff --git a/scripts/bundleTs.mjs b/scripts/bundleTs.mjs index 4961d41ad2c6..30f26220f286 100644 --- a/scripts/bundleTs.mjs +++ b/scripts/bundleTs.mjs @@ -38,7 +38,7 @@ const copyrightSnippet = ` const typesNodeReferenceDirective = '/// '; -const excludedPackages = new Set(['@jest/globals']); +const excludedPackages = new Set(['@jest/globals', 'jest']); (async () => { const packages = getPackages(); diff --git a/yarn.lock b/yarn.lock index 851b6ea55d14..f33cb61df42c 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2742,7 +2742,6 @@ __metadata: "@types/babel__generator": ^7.0.0 "@types/babel__template": ^7.0.2 "@types/dedent": ^0.7.0 - "@types/jest": ^27.4.0 "@types/node": ~14.14.45 "@types/which": ^2.0.0 "@typescript-eslint/eslint-plugin": ^5.14.0 @@ -4612,16 +4611,6 @@ __metadata: languageName: node linkType: hard -"@types/jest@npm:^27.4.0": - version: 27.5.2 - resolution: "@types/jest@npm:27.5.2" - dependencies: - jest-matcher-utils: ^27.0.0 - pretty-format: ^27.0.0 - checksum: 7e11c6826aa429ad990dc262e4e4b54aa36573287fddf15773e4137f07d11d3105f0dd9f1baff73252160a057df23f5529bb83b1bf83cd3f45f9460a5ca5c22e - languageName: node - linkType: hard - "@types/jsdom@npm:^20.0.0": version: 20.0.0 resolution: "@types/jsdom@npm:20.0.0" @@ -5670,7 +5659,6 @@ __metadata: "@babel/plugin-proposal-decorators": "*" "@babel/preset-env": ^7.1.0 "@babel/preset-typescript": ^7.0.0 - "@types/jest": ^27.4.0 babel-jest: "workspace:*" babel-plugin-transform-typescript-metadata: "*" core-js: ^3.2.1 @@ -8341,13 +8329,6 @@ __metadata: languageName: node linkType: hard -"diff-sequences@npm:^27.5.1": - version: 27.5.1 - resolution: "diff-sequences@npm:27.5.1" - checksum: a00db5554c9da7da225db2d2638d85f8e41124eccbd56cbaefb3b276dcbb1c1c2ad851c32defe2055a54a4806f030656cbf6638105fd6ce97bb87b90b32a33ca - languageName: node - linkType: hard - "diff-sequences@workspace:^, diff-sequences@workspace:packages/diff-sequences": version: 0.0.0-use.local resolution: "diff-sequences@workspace:packages/diff-sequences" @@ -9540,7 +9521,6 @@ __metadata: "@babel/preset-env": ^7.1.0 "@babel/preset-react": ^7.12.1 "@babel/preset-typescript": ^7.0.0 - "@types/jest": ^27.4.0 babel-jest: "workspace:*" jest: "workspace:*" react: 17.0.2 @@ -12362,18 +12342,6 @@ __metadata: languageName: unknown linkType: soft -"jest-diff@npm:^27.5.1": - version: 27.5.1 - resolution: "jest-diff@npm:27.5.1" - dependencies: - chalk: ^4.0.0 - diff-sequences: ^27.5.1 - jest-get-type: ^27.5.1 - pretty-format: ^27.5.1 - checksum: 8be27c1e1ee57b2bb2bef9c0b233c19621b4c43d53a3c26e2c00a4e805eb4ea11fe1694a06a9fb0e80ffdcfdc0d2b1cb0b85920b3f5c892327ecd1e7bd96b865 - languageName: node - linkType: hard - "jest-diff@workspace:^, jest-diff@workspace:packages/jest-diff": version: 0.0.0-use.local resolution: "jest-diff@workspace:packages/jest-diff" @@ -12445,13 +12413,6 @@ __metadata: languageName: node linkType: hard -"jest-get-type@npm:^27.5.1": - version: 27.5.1 - resolution: "jest-get-type@npm:27.5.1" - checksum: 63064ab70195c21007d897c1157bf88ff94a790824a10f8c890392e7d17eda9c3900513cb291ca1c8d5722cad79169764e9a1279f7c8a9c4cd6e9109ff04bbc0 - languageName: node - linkType: hard - "jest-get-type@workspace:^, jest-get-type@workspace:packages/jest-get-type": version: 0.0.0-use.local resolution: "jest-get-type@workspace:packages/jest-get-type" @@ -12554,18 +12515,6 @@ __metadata: languageName: unknown linkType: soft -"jest-matcher-utils@npm:^27.0.0": - version: 27.5.1 - resolution: "jest-matcher-utils@npm:27.5.1" - dependencies: - chalk: ^4.0.0 - jest-diff: ^27.5.1 - jest-get-type: ^27.5.1 - pretty-format: ^27.5.1 - checksum: bb2135fc48889ff3fe73888f6cc7168ddab9de28b51b3148f820c89fdfd2effdcad005f18be67d0b9be80eda208ad47290f62f03d0a33f848db2dd0273c8217a - languageName: node - linkType: hard - "jest-matcher-utils@workspace:^, jest-matcher-utils@workspace:packages/jest-matcher-utils": version: 0.0.0-use.local resolution: "jest-matcher-utils@workspace:packages/jest-matcher-utils" @@ -13098,10 +13047,12 @@ __metadata: resolution: "jest@workspace:packages/jest" dependencies: "@jest/core": "workspace:^" + "@jest/globals": "workspace:^" "@jest/types": "workspace:^" "@tsd/typescript": ~4.7.4 import-local: ^3.0.2 jest-cli: "workspace:^" + jest-mock: "workspace:^" tsd-lite: ^0.5.6 peerDependencies: node-notifier: ^8.0.1 || ^9.0.0 || ^10.0.0 @@ -16879,7 +16830,7 @@ __metadata: languageName: node linkType: hard -"pretty-format@npm:^27.0.0, pretty-format@npm:^27.0.2, pretty-format@npm:^27.5.1": +"pretty-format@npm:^27.0.2": version: 27.5.1 resolution: "pretty-format@npm:27.5.1" dependencies: