Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: replace @types/jest with a new private @jest/test-globals package #13344

Merged
merged 15 commits into from
Oct 1, 2022
23 changes: 4 additions & 19 deletions e2e/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,22 +1,7 @@
{
"extends": "../tsconfig.test.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
}
"rootDir": "./"
},
"include": ["./**/*"]
}
1 change: 1 addition & 0 deletions examples/angular/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
"@babel/plugin-proposal-decorators": "*",
"@babel/preset-env": "^7.1.0",
"@babel/preset-typescript": "^7.0.0",
"@jest/globals": "workspace:^",
"babel-jest": "workspace:^",
"babel-plugin-transform-typescript-metadata": "*",
"jest": "workspace:^",
Expand Down
3 changes: 2 additions & 1 deletion examples/typescript/__tests__/CheckboxWithLabel-test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@

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

it('CheckboxWithLabel changes the text after click', () => {
const checkboxLabelRef: React.RefObject<HTMLLabelElement> = React.createRef();
Expand Down
2 changes: 1 addition & 1 deletion examples/typescript/__tests__/calc.test.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// Copyright (c) 2014-present, Facebook, Inc. All rights reserved.

import {jest} from '@jest/globals';
import {describe, expect, it, jest} from '@jest/globals';
import Memory from '../Memory';
import makeCalc from '../calc';
import sub from '../sub';
Expand Down
1 change: 1 addition & 0 deletions examples/typescript/__tests__/sub-test.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
// Copyright (c) 2014-present, Facebook, Inc. All rights reserved.

import {expect, it} from '@jest/globals';
import sub from '../sub';

it('subtracts 5 - 1 to equal 4 in TypeScript', () => {
Expand Down
2 changes: 2 additions & 0 deletions examples/typescript/__tests__/sum-test.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
// Copyright (c) 2014-present, Facebook, Inc. All rights reserved.

import {expect, it} from '@jest/globals';

it('adds 1 + 2 to equal 3 in TScript', () => {
// Generally, `import` should be used for TypeScript
// as using `require` will not return any type information.
Expand Down
2 changes: 2 additions & 0 deletions examples/typescript/__tests__/sum.test.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
// Copyright 2004-present Facebook. All Rights Reserved.

import {expect, it} from '@jest/globals';

it('adds 1 + 2 to equal 3 in Typescript', () => {
const sum = require('../sum.ts').default;
expect(sum(1, 2)).toBe(3);
Expand Down
2 changes: 1 addition & 1 deletion examples/typescript/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
"@babel/preset-env": "^7.1.0",
"@babel/preset-react": "^7.12.1",
"@babel/preset-typescript": "^7.0.0",
"@types/jest": "^27.4.0",
"@jest/globals": "workspace:^",
"babel-jest": "workspace:^",
"jest": "workspace:^"
},
Expand Down
1 change: 0 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
7 changes: 7 additions & 0 deletions packages/babel-jest/src/__tests__/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"extends": "../../../../tsconfig.test.json",
"compilerOptions": {
"rootDir": "../"
},
"include": ["../**/*"]
}
7 changes: 7 additions & 0 deletions packages/babel-plugin-jest-hoist/src/__tests__/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"extends": "../../../../tsconfig.test.json",
"compilerOptions": {
"rootDir": "../"
},
"include": ["../**/*"]
}
7 changes: 7 additions & 0 deletions packages/diff-sequences/src/__tests__/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"extends": "../../../../tsconfig.test.json",
"compilerOptions": {
"rootDir": "../"
},
"include": ["../**/*"]
}
2 changes: 2 additions & 0 deletions packages/expect-utils/src/__tests__/isError.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@
* @jest-environment jsdom
*/

/// <reference lib="dom" />

/* eslint-env browser */

import {isError} from '../utils';
Expand Down
7 changes: 7 additions & 0 deletions packages/expect-utils/src/__tests__/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"extends": "../../../../tsconfig.test.json",
"compilerOptions": {
"rootDir": "../"
},
"include": ["../**/*"]
}
3 changes: 3 additions & 0 deletions packages/expect/src/__tests__/toEqual-dom.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@
*
* @jest-environment jsdom
*/

/// <reference lib="dom" />

/* eslint-env browser*/

describe('toEqual', () => {
Expand Down
7 changes: 7 additions & 0 deletions packages/expect/src/__tests__/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"extends": "../../../../tsconfig.test.json",
"compilerOptions": {
"rootDir": "../"
},
"include": ["../**/*"]
}
7 changes: 7 additions & 0 deletions packages/jest-circus/src/__tests__/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"extends": "../../../../tsconfig.test.json",
"compilerOptions": {
"rootDir": "../"
},
"include": ["../**/*"]
}
4 changes: 1 addition & 3 deletions packages/jest-circus/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -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__/**/*"],
Expand Down
7 changes: 7 additions & 0 deletions packages/jest-cli/src/__tests__/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"extends": "../../../../tsconfig.test.json",
"compilerOptions": {
"rootDir": "../"
},
"include": ["../**/*"]
}
7 changes: 7 additions & 0 deletions packages/jest-cli/src/init/__tests__/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"extends": "../../../../../tsconfig.test.json",
"compilerOptions": {
"rootDir": "../../"
},
"include": ["../**/*"]
}
7 changes: 7 additions & 0 deletions packages/jest-config/src/__tests__/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"extends": "../../../../tsconfig.test.json",
"compilerOptions": {
"rootDir": "../"
},
"include": ["../**/*"]
}
7 changes: 7 additions & 0 deletions packages/jest-console/src/__tests__/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"extends": "../../../../tsconfig.test.json",
"compilerOptions": {
"rootDir": "../"
},
"include": ["../**/*"]
}
7 changes: 7 additions & 0 deletions packages/jest-core/src/__tests__/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"extends": "../../../../tsconfig.test.json",
"compilerOptions": {
"rootDir": "../"
},
"include": ["../**/*"]
}
7 changes: 7 additions & 0 deletions packages/jest-core/src/lib/__tests__/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"extends": "../../../../../tsconfig.test.json",
"compilerOptions": {
"rootDir": "../../"
},
"include": ["../**/*"]
}
7 changes: 7 additions & 0 deletions packages/jest-core/src/plugins/__tests__/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"extends": "../../../../../tsconfig.test.json",
"compilerOptions": {
"rootDir": "../../"
},
"include": ["../**/*"]
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"extends": "../../../../tsconfig.test.json",
"compilerOptions": {
"rootDir": "../"
},
"include": ["../**/*"]
}
7 changes: 7 additions & 0 deletions packages/jest-diff/src/__tests__/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"extends": "../../../../tsconfig.test.json",
"compilerOptions": {
"rootDir": "../"
},
"include": ["../**/*"]
}
7 changes: 7 additions & 0 deletions packages/jest-docblock/src/__tests__/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"extends": "../../../../tsconfig.test.json",
"compilerOptions": {
"rootDir": "../"
},
"include": ["../**/*"]
}
7 changes: 7 additions & 0 deletions packages/jest-each/src/__tests__/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"extends": "../../../../tsconfig.test.json",
"compilerOptions": {
"rootDir": "../"
},
"include": ["../**/*"]
}
7 changes: 7 additions & 0 deletions packages/jest-environment-jsdom/src/__tests__/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"extends": "../../../../tsconfig.test.json",
"compilerOptions": {
"rootDir": "../"
},
"include": ["../**/*"]
}
7 changes: 7 additions & 0 deletions packages/jest-environment-node/src/__tests__/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"extends": "../../../../tsconfig.test.json",
"compilerOptions": {
"rootDir": "../"
},
"include": ["../**/*"]
}
2 changes: 0 additions & 2 deletions packages/jest-environment/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
{
"extends": "../../tsconfig.json",
"compilerOptions": {
// we don't want `@types/jest` to be referenced
"types": ["node"],
"rootDir": "src",
"outDir": "build"
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@
* LICENSE file in the root directory of this source tree.
*/

/// <reference lib="dom" />
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

really? how? it's running in node env, so shouldn't need or use any DOM APIs

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ah, for rAF it makes sense 👍


import * as util from 'util';
import {runInNewContext} from 'vm';
import {ModuleMocker} from 'jest-mock';
Expand Down
7 changes: 7 additions & 0 deletions packages/jest-fake-timers/src/__tests__/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"extends": "../../../../tsconfig.test.json",
"compilerOptions": {
"rootDir": "../"
},
"include": ["../**/*"]
}
7 changes: 7 additions & 0 deletions packages/jest-get-type/src/__tests__/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"extends": "../../../../tsconfig.test.json",
"compilerOptions": {
"rootDir": "../"
},
"include": ["../**/*"]
}
7 changes: 7 additions & 0 deletions packages/jest-globals/src/__tests__/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"extends": "../../../../tsconfig.test.json",
"compilerOptions": {
"rootDir": "../"
},
"include": ["../**/*"]
}
2 changes: 0 additions & 2 deletions packages/jest-globals/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
{
"extends": "../../tsconfig.json",
"compilerOptions": {
// we don't want `@types/jest` to be referenced
"types": [],
"rootDir": "src",
"outDir": "build"
},
Expand Down
7 changes: 7 additions & 0 deletions packages/jest-haste-map/src/__tests__/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"extends": "../../../../tsconfig.test.json",
"compilerOptions": {
"rootDir": "../"
},
"include": ["../**/*"]
}
7 changes: 7 additions & 0 deletions packages/jest-haste-map/src/crawlers/__tests__/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"extends": "../../../../../tsconfig.test.json",
"compilerOptions": {
"rootDir": "../../"
},
"include": ["../**/*"]
}
7 changes: 7 additions & 0 deletions packages/jest-haste-map/src/lib/__tests__/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"extends": "../../../../../tsconfig.test.json",
"compilerOptions": {
"rootDir": "../../"
},
"include": ["../**/*"]
}
7 changes: 7 additions & 0 deletions packages/jest-jasmine2/src/__tests__/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"extends": "../../../../tsconfig.test.json",
"compilerOptions": {
"rootDir": "../"
},
"include": ["../**/*"]
}
4 changes: 1 addition & 3 deletions packages/jest-jasmine2/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -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__/**/*"],
Expand Down
7 changes: 7 additions & 0 deletions packages/jest-leak-detector/src/__tests__/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"extends": "../../../../tsconfig.test.json",
"compilerOptions": {
"rootDir": "../"
},
"include": ["../**/*"]
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,11 @@
*
* @jest-environment jsdom
*/

/// <reference lib="dom" />

/* eslint-env browser*/

import deepCyclicCopyReplaceable from '../deepCyclicCopyReplaceable';

test('should copy dom element', () => {
Expand Down
7 changes: 7 additions & 0 deletions packages/jest-matcher-utils/src/__tests__/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"extends": "../../../../tsconfig.test.json",
"compilerOptions": {
"rootDir": "../"
},
"include": ["../**/*"]
}
Loading