Skip to content

Commit eafabf9

Browse files
authored
chore: replace @types/jest with a new private @jest/test-globals package (#13344)
1 parent c6b812d commit eafabf9

File tree

76 files changed

+508
-94
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

76 files changed

+508
-94
lines changed

e2e/tsconfig.json

Lines changed: 4 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,7 @@
11
{
2+
"extends": "../tsconfig.test.json",
23
"compilerOptions": {
3-
"noEmit": true,
4-
5-
"target": "es2017",
6-
"module": "commonjs",
7-
"lib": ["dom", "es2017"],
8-
"strict": true,
9-
10-
/* Additional Checks */
11-
"noUnusedLocals": true,
12-
"noUnusedParameters": true,
13-
"noImplicitReturns": true,
14-
"noFallthroughCasesInSwitch": true,
15-
16-
/* Module Resolution Options */
17-
"moduleResolution": "node",
18-
"isolatedModules": true,
19-
"importsNotUsedAsValues": "error",
20-
"resolveJsonModule": true
21-
}
4+
"rootDir": "./"
5+
},
6+
"include": ["./**/*"]
227
}

examples/angular/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
"@babel/plugin-proposal-decorators": "*",
2424
"@babel/preset-env": "^7.1.0",
2525
"@babel/preset-typescript": "^7.0.0",
26+
"@jest/globals": "workspace:^",
2627
"babel-jest": "workspace:^",
2728
"babel-plugin-transform-typescript-metadata": "*",
2829
"jest": "workspace:^",

examples/typescript/__tests__/CheckboxWithLabel-test.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,8 @@
22

33
import * as React from 'react';
44
import * as TestUtils from 'react-dom/test-utils';
5-
const CheckboxWithLabel = require('../CheckboxWithLabel').default;
5+
import {expect, it} from '@jest/globals';
6+
import CheckboxWithLabel from '../CheckboxWithLabel';
67

78
it('CheckboxWithLabel changes the text after click', () => {
89
const checkboxLabelRef: React.RefObject<HTMLLabelElement> = React.createRef();

examples/typescript/__tests__/calc.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
// Copyright (c) 2014-present, Facebook, Inc. All rights reserved.
22

3-
import {jest} from '@jest/globals';
3+
import {describe, expect, it, jest} from '@jest/globals';
44
import Memory from '../Memory';
55
import makeCalc from '../calc';
66
import sub from '../sub';

examples/typescript/__tests__/sub-test.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
// Copyright (c) 2014-present, Facebook, Inc. All rights reserved.
22

3+
import {expect, it} from '@jest/globals';
34
import sub from '../sub';
45

56
it('subtracts 5 - 1 to equal 4 in TypeScript', () => {

examples/typescript/__tests__/sum-test.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
// Copyright (c) 2014-present, Facebook, Inc. All rights reserved.
22

3+
import {expect, it} from '@jest/globals';
4+
35
it('adds 1 + 2 to equal 3 in TScript', () => {
46
// Generally, `import` should be used for TypeScript
57
// as using `require` will not return any type information.

examples/typescript/__tests__/sum.test.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
// Copyright 2004-present Facebook. All Rights Reserved.
22

3+
import {expect, it} from '@jest/globals';
4+
35
it('adds 1 + 2 to equal 3 in Typescript', () => {
46
const sum = require('../sum.ts').default;
57
expect(sum(1, 2)).toBe(3);

examples/typescript/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
"@babel/preset-env": "^7.1.0",
1313
"@babel/preset-react": "^7.12.1",
1414
"@babel/preset-typescript": "^7.0.0",
15-
"@types/jest": "^27.4.0",
15+
"@jest/globals": "workspace:^",
1616
"babel-jest": "workspace:^",
1717
"jest": "workspace:^"
1818
},

package.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@
2020
"@types/babel__generator": "^7.0.0",
2121
"@types/babel__template": "^7.0.2",
2222
"@types/dedent": "^0.7.0",
23-
"@types/jest": "^27.4.0",
2423
"@types/node": "~14.14.45",
2524
"@types/which": "^2.0.0",
2625
"@typescript-eslint/eslint-plugin": "^5.14.0",
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
"extends": "../../../../tsconfig.test.json",
3+
"compilerOptions": {
4+
"rootDir": "../"
5+
},
6+
"include": ["../**/*"]
7+
}
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
"extends": "../../../../tsconfig.test.json",
3+
"compilerOptions": {
4+
"rootDir": "../"
5+
},
6+
"include": ["../**/*"]
7+
}
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
"extends": "../../../../tsconfig.test.json",
3+
"compilerOptions": {
4+
"rootDir": "../"
5+
},
6+
"include": ["../**/*"]
7+
}

packages/expect-utils/src/__tests__/isError.test.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@
77
* @jest-environment jsdom
88
*/
99

10+
/// <reference lib="dom" />
11+
1012
/* eslint-env browser */
1113

1214
import {isError} from '../utils';
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
"extends": "../../../../tsconfig.test.json",
3+
"compilerOptions": {
4+
"rootDir": "../"
5+
},
6+
"include": ["../**/*"]
7+
}

packages/expect/src/__tests__/toEqual-dom.test.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,9 @@
66
*
77
* @jest-environment jsdom
88
*/
9+
10+
/// <reference lib="dom" />
11+
912
/* eslint-env browser*/
1013

1114
describe('toEqual', () => {
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
"extends": "../../../../tsconfig.test.json",
3+
"compilerOptions": {
4+
"rootDir": "../"
5+
},
6+
"include": ["../**/*"]
7+
}
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
"extends": "../../../../tsconfig.test.json",
3+
"compilerOptions": {
4+
"rootDir": "../"
5+
},
6+
"include": ["../**/*"]
7+
}

packages/jest-circus/tsconfig.json

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,7 @@
22
"extends": "../../tsconfig",
33
"compilerOptions": {
44
"outDir": "build",
5-
"rootDir": "src",
6-
// we don't want `@types/jest` to be referenced
7-
"types": []
5+
"rootDir": "src"
86
},
97
"include": ["./src/**/*"],
108
"exclude": ["./**/__mocks__/**/*", "./**/__tests__/**/*"],
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
"extends": "../../../../tsconfig.test.json",
3+
"compilerOptions": {
4+
"rootDir": "../"
5+
},
6+
"include": ["../**/*"]
7+
}
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
"extends": "../../../../../tsconfig.test.json",
3+
"compilerOptions": {
4+
"rootDir": "../../"
5+
},
6+
"include": ["../**/*"]
7+
}
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
"extends": "../../../../tsconfig.test.json",
3+
"compilerOptions": {
4+
"rootDir": "../"
5+
},
6+
"include": ["../**/*"]
7+
}
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
"extends": "../../../../tsconfig.test.json",
3+
"compilerOptions": {
4+
"rootDir": "../"
5+
},
6+
"include": ["../**/*"]
7+
}
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
"extends": "../../../../tsconfig.test.json",
3+
"compilerOptions": {
4+
"rootDir": "../"
5+
},
6+
"include": ["../**/*"]
7+
}
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
"extends": "../../../../../tsconfig.test.json",
3+
"compilerOptions": {
4+
"rootDir": "../../"
5+
},
6+
"include": ["../**/*"]
7+
}
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
"extends": "../../../../../tsconfig.test.json",
3+
"compilerOptions": {
4+
"rootDir": "../../"
5+
},
6+
"include": ["../**/*"]
7+
}
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
"extends": "../../../../tsconfig.test.json",
3+
"compilerOptions": {
4+
"rootDir": "../"
5+
},
6+
"include": ["../**/*"]
7+
}
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
"extends": "../../../../tsconfig.test.json",
3+
"compilerOptions": {
4+
"rootDir": "../"
5+
},
6+
"include": ["../**/*"]
7+
}
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
"extends": "../../../../tsconfig.test.json",
3+
"compilerOptions": {
4+
"rootDir": "../"
5+
},
6+
"include": ["../**/*"]
7+
}
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
"extends": "../../../../tsconfig.test.json",
3+
"compilerOptions": {
4+
"rootDir": "../"
5+
},
6+
"include": ["../**/*"]
7+
}
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
"extends": "../../../../tsconfig.test.json",
3+
"compilerOptions": {
4+
"rootDir": "../"
5+
},
6+
"include": ["../**/*"]
7+
}
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
"extends": "../../../../tsconfig.test.json",
3+
"compilerOptions": {
4+
"rootDir": "../"
5+
},
6+
"include": ["../**/*"]
7+
}

packages/jest-environment/tsconfig.json

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
{
22
"extends": "../../tsconfig.json",
33
"compilerOptions": {
4-
// we don't want `@types/jest` to be referenced
5-
"types": ["node"],
64
"rootDir": "src",
75
"outDir": "build"
86
},

packages/jest-fake-timers/src/__tests__/legacyFakeTimers.test.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@
55
* LICENSE file in the root directory of this source tree.
66
*/
77

8+
/// <reference lib="dom" />
9+
810
import * as util from 'util';
911
import {runInNewContext} from 'vm';
1012
import {ModuleMocker} from 'jest-mock';
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
"extends": "../../../../tsconfig.test.json",
3+
"compilerOptions": {
4+
"rootDir": "../"
5+
},
6+
"include": ["../**/*"]
7+
}
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
"extends": "../../../../tsconfig.test.json",
3+
"compilerOptions": {
4+
"rootDir": "../"
5+
},
6+
"include": ["../**/*"]
7+
}
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
"extends": "../../../../tsconfig.test.json",
3+
"compilerOptions": {
4+
"rootDir": "../"
5+
},
6+
"include": ["../**/*"]
7+
}

packages/jest-globals/tsconfig.json

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
{
22
"extends": "../../tsconfig.json",
33
"compilerOptions": {
4-
// we don't want `@types/jest` to be referenced
5-
"types": [],
64
"rootDir": "src",
75
"outDir": "build"
86
},
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
"extends": "../../../../tsconfig.test.json",
3+
"compilerOptions": {
4+
"rootDir": "../"
5+
},
6+
"include": ["../**/*"]
7+
}
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
"extends": "../../../../../tsconfig.test.json",
3+
"compilerOptions": {
4+
"rootDir": "../../"
5+
},
6+
"include": ["../**/*"]
7+
}
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
"extends": "../../../../../tsconfig.test.json",
3+
"compilerOptions": {
4+
"rootDir": "../../"
5+
},
6+
"include": ["../**/*"]
7+
}
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
"extends": "../../../../tsconfig.test.json",
3+
"compilerOptions": {
4+
"rootDir": "../"
5+
},
6+
"include": ["../**/*"]
7+
}

packages/jest-jasmine2/tsconfig.json

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,7 @@
22
"extends": "../../tsconfig",
33
"compilerOptions": {
44
"rootDir": "src",
5-
"outDir": "build",
6-
// we don't want `@types/jest` to be referenced
7-
"types": []
5+
"outDir": "build"
86
},
97
"include": ["./src/**/*"],
108
"exclude": ["./**/__tests__/**/*"],
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
"extends": "../../../../tsconfig.test.json",
3+
"compilerOptions": {
4+
"rootDir": "../"
5+
},
6+
"include": ["../**/*"]
7+
}

packages/jest-matcher-utils/src/__tests__/deepCyclicCopyReplaceableDom.test.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,11 @@
66
*
77
* @jest-environment jsdom
88
*/
9+
10+
/// <reference lib="dom" />
11+
912
/* eslint-env browser*/
13+
1014
import deepCyclicCopyReplaceable from '../deepCyclicCopyReplaceable';
1115

1216
test('should copy dom element', () => {
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
"extends": "../../../../tsconfig.test.json",
3+
"compilerOptions": {
4+
"rootDir": "../"
5+
},
6+
"include": ["../**/*"]
7+
}

0 commit comments

Comments
 (0)