Skip to content

Commit bc23f43

Browse files
authored
chore: move TestUtils file into test utils package (#10756)
1 parent f9132f9 commit bc23f43

Some content is hidden

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

44 files changed

+68
-34
lines changed

packages/babel-jest/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
},
2323
"devDependencies": {
2424
"@babel/core": "^7.1.0",
25+
"@jest/test-utils": "^26.5.0",
2526
"@types/graceful-fs": "^4.1.3"
2627
},
2728
"peerDependencies": {

packages/babel-jest/src/__tests__/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
* LICENSE file in the root directory of this source tree.
66
*/
77

8-
import {makeProjectConfig} from '../../../../TestUtils';
8+
import {makeProjectConfig} from '@jest/test-utils';
99
import babelJest = require('../index');
1010
import {loadPartialConfig} from '../loadBabelConfig';
1111

packages/babel-jest/tsconfig.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
// TODO: include `babel-preset-jest` if it's ever in TS even though we don't care about its types
88
"references": [
99
{"path": "../jest-transform"},
10-
{"path": "../jest-types"}
10+
{"path": "../jest-types"},
11+
{"path": "../test-utils"}
1112
]
1213
}

packages/jest-config/src/__tests__/resolveConfigPath.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,9 @@
77

88
import {tmpdir} from 'os';
99
import * as path from 'path';
10+
import {cleanup, writeFiles} from '../../../../e2e/Utils';
1011
import {JEST_CONFIG_EXT_ORDER} from '../constants';
1112
import resolveConfigPath from '../resolveConfigPath';
12-
const {cleanup, writeFiles} = require('../../../../e2e/Utils');
1313

1414
const DIR = path.resolve(tmpdir(), 'resolve_config_path_test');
1515
const ERROR_PATTERN = /Could not find a config file based on provided values/;

packages/jest-console/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
"slash": "^3.0.0"
1919
},
2020
"devDependencies": {
21+
"@jest/test-utils": "^26.5.0",
2122
"@types/node": "*"
2223
},
2324
"engines": {

packages/jest-console/src/__tests__/getConsoleOutput.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@
55
* LICENSE file in the root directory of this source tree.
66
*/
77

8+
import {makeGlobalConfig} from '@jest/test-utils';
89
import {formatStackTrace} from 'jest-message-util';
9-
import {makeGlobalConfig} from '../../../../TestUtils';
1010
import BufferedConsole from '../BufferedConsole';
1111
import getConsoleOutput from '../getConsoleOutput';
1212
import type {LogType} from '../types';

packages/jest-console/tsconfig.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
"references": [
88
{"path": "../jest-message-util"},
99
{"path": "../jest-types"},
10-
{"path": "../jest-util"}
10+
{"path": "../jest-util"},
11+
{"path": "../test-utils"}
1112
]
1213
}

packages/jest-core/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@
3636
},
3737
"devDependencies": {
3838
"@jest/test-sequencer": "^26.6.1",
39+
"@jest/test-utils": "^26.5.0",
3940
"@types/exit": "^0.1.30",
4041
"@types/graceful-fs": "^4.1.2",
4142
"@types/micromatch": "^4.0.0",

packages/jest-core/src/__tests__/TestScheduler.test.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
*/
88

99
import {SummaryReporter} from '@jest/reporters';
10-
import {makeProjectConfig} from '../../../../TestUtils';
10+
import {makeProjectConfig} from '@jest/test-utils';
1111
import TestScheduler from '../TestScheduler';
1212
import * as testSchedulerHelper from '../testSchedulerHelper';
1313

packages/jest-core/src/__tests__/watchFileChanges.test.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,8 @@ describe('Watch mode flows with changed files', () => {
3131
const cacheDirectory = path.resolve(tmpdir(), `tmp${Math.random()}`);
3232
let hasteMapInstance: HasteMap;
3333

34-
beforeEach(() => {
35-
watch = require('../watch').default;
34+
beforeEach(async () => {
35+
watch = (await import('../watch')).default;
3636
pipe = {write: jest.fn()} as unknown;
3737
stdin = new MockStdin();
3838
rimraf.sync(cacheDirectory);

0 commit comments

Comments
 (0)