Skip to content

Commit 3d4dae1

Browse files
committed
chore: convert jest-runtime to ESM
1 parent 7e5e27a commit 3d4dae1

File tree

17 files changed

+36
-42
lines changed

17 files changed

+36
-42
lines changed

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@
66

77
### Chore & Maintenance
88

9+
- `[jest-runtime]` [**BREAKING**] Convert to ESM ([#10325](https://github.com/facebook/jest/pull/10325))
10+
911
### Performance
1012

1113
## 26.4.2

packages/jest-circus/src/legacy-code-todo-rewrite/jestAdapter.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import type {Config} from '@jest/types';
1010
import type {JestEnvironment} from '@jest/environment';
1111
import type {TestResult} from '@jest/test-result';
1212
import type {TestFileEvent} from 'jest-runner';
13-
import type {RuntimeType as Runtime} from 'jest-runtime';
13+
import type Runtime from 'jest-runtime';
1414
import type {SnapshotStateType} from 'jest-snapshot';
1515
import {deepCyclicCopy} from 'jest-util';
1616

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

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

99
import * as path from 'path';
10-
import Runtime = require('jest-runtime');
10+
import Runtime from 'jest-runtime';
1111
import {normalize} from 'jest-config';
1212
import {Test} from 'jest-runner';
1313
import type {Config} from '@jest/types';

packages/jest-core/src/__tests__/watch-file-changes.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import * as path from 'path';
1010
import {tmpdir} from 'os';
1111
import * as fs from 'graceful-fs';
1212
import {JestHook} from 'jest-watcher';
13-
import Runtime = require('jest-runtime');
13+
import Runtime from 'jest-runtime';
1414
import {normalize} from 'jest-config';
1515
import HasteMap = require('jest-haste-map');
1616
import rimraf = require('rimraf');

packages/jest-core/src/cli/index.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import type {AggregatedResult} from '@jest/test-result';
1010
import {CustomConsole} from '@jest/console';
1111
import {createDirectory, preRunMessage} from 'jest-util';
1212
import {readConfigs} from 'jest-config';
13-
import Runtime = require('jest-runtime');
13+
import Runtime, {Context} from 'jest-runtime';
1414
import type {ChangedFilesPromise} from 'jest-changed-files';
1515
import HasteMap = require('jest-haste-map');
1616
import chalk = require('chalk');
@@ -218,7 +218,7 @@ const _run10000 = async (
218218
};
219219

220220
const runWatch = async (
221-
contexts: Array<Runtime.Context>,
221+
contexts: Array<Context>,
222222
_configs: Array<Config.ProjectConfig>,
223223
hasDeprecationWarnings: boolean,
224224
globalConfig: Config.GlobalConfig,
@@ -256,7 +256,7 @@ const runWatch = async (
256256

257257
const runWithoutWatch = async (
258258
globalConfig: Config.GlobalConfig,
259-
contexts: Array<Runtime.Context>,
259+
contexts: Array<Context>,
260260
outputStream: NodeJS.WriteStream,
261261
onComplete: OnCompleteCallback,
262262
changedFilesPromise?: ChangedFilesPromise,

packages/jest-core/src/lib/create_context.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,13 @@
66
*/
77

88
import type {Config} from '@jest/types';
9-
import Runtime = require('jest-runtime');
9+
import Runtime, {Context} from 'jest-runtime';
1010
import type {HasteMapObject} from 'jest-haste-map';
1111

1212
export default (
1313
config: Config.ProjectConfig,
1414
{hasteFS, moduleMap}: HasteMapObject,
15-
): Runtime.Context => ({
15+
): Context => ({
1616
config,
1717
hasteFS,
1818
moduleMap,

packages/jest-jasmine2/src/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import type {Config, Global} from '@jest/types';
1010
import type {AssertionResult, TestResult} from '@jest/test-result';
1111
import type {JestEnvironment} from '@jest/environment';
1212
import type {SnapshotStateType} from 'jest-snapshot';
13-
import type {RuntimeType as Runtime} from 'jest-runtime';
13+
import type Runtime from 'jest-runtime';
1414

1515
import {getCallsite} from '@jest/source-map';
1616
import installEach from './each';

packages/jest-repl/src/cli/args.ts

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

99
import type {Options} from 'yargs';
10-
import Runtime = require('jest-runtime');
10+
import Runtime from 'jest-runtime';
1111

1212
export const usage = 'Usage: $0 [--config=<pathToConfigFile>]';
1313

packages/jest-repl/src/cli/index.ts

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

10-
import Runtime = require('jest-runtime');
10+
import Runtime from 'jest-runtime';
1111
import yargs = require('yargs');
1212
import {validateCLIOptions} from 'jest-validate';
1313
import {deprecationEntries} from 'jest-config';

packages/jest-resolve-dependencies/src/__tests__/dependency_resolver.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ const filter = (path: Config.Path) =>
2727
Object.keys(cases).every(key => cases[key](path));
2828

2929
beforeEach(() => {
30-
Runtime = require('jest-runtime');
30+
Runtime = require('jest-runtime').default;
3131
config = makeProjectConfig({
3232
cacheDirectory: path.resolve(tmpdir(), 'jest-resolve-dependencies-test'),
3333
moduleDirectories: ['node_modules'],

0 commit comments

Comments
 (0)