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+
}

0 commit comments

Comments
 (0)