Skip to content

Commit 06c1fe6

Browse files
committed
chore: convert jest-runtime to ESM
1 parent 30b6cee commit 06c1fe6

File tree

15 files changed

+22
-27
lines changed

15 files changed

+22
-27
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66

77
### Fixes
88

9+
- `[jest-runtime]` [**BREAKING**] Convert to ESM ([#10325](https://github.com/facebook/jest/pull/10325))
910
- `[jest-transform]` Show enhanced `SyntaxError` message for all `SyntaxError`s ([#10749](https://github.com/facebook/jest/pull/10749))
1011

1112
### Chore & Maintenance

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

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

packages/jest-core/src/__tests__/SearchSource.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 type {Config} from '@jest/types';
1111
import {normalize} from 'jest-config';
1212
import {Test} from 'jest-runner';
13-
import Runtime = require('jest-runtime');
13+
import Runtime from 'jest-runtime';
1414
import SearchSource, {SearchResult} from '../SearchSource';
1515

1616
jest.setTimeout(15000);

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ import rimraf = require('rimraf');
1313
import type {AggregatedResult} from '@jest/test-result';
1414
import {normalize} from 'jest-config';
1515
import HasteMap = require('jest-haste-map');
16-
import Runtime = require('jest-runtime');
16+
import Runtime from 'jest-runtime';
1717
import {JestHook} from 'jest-watcher';
1818

1919
describe('Watch mode flows with changed files', () => {

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ import type {Config} from '@jest/types';
1414
import type {ChangedFilesPromise} from 'jest-changed-files';
1515
import {readConfigs} from 'jest-config';
1616
import HasteMap = require('jest-haste-map');
17-
import Runtime = require('jest-runtime');
17+
import Runtime, {Context} from 'jest-runtime';
1818
import {createDirectory, preRunMessage} from 'jest-util';
1919
import TestWatcher from '../TestWatcher';
2020
import {formatHandleErrors} from '../collectHandles';
@@ -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/createContext.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,12 @@
77

88
import type {Config} from '@jest/types';
99
import type {HasteMapObject} from 'jest-haste-map';
10-
import Runtime = require('jest-runtime');
10+
import Runtime, {Context} from 'jest-runtime';
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 {JestEnvironment} from '@jest/environment';
1010
import {getCallsite} from '@jest/source-map';
1111
import type {AssertionResult, TestResult} from '@jest/test-result';
1212
import type {Config, Global} from '@jest/types';
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 installEach from './each';
1616
import {installErrorOnPrivate} from './errorOnPrivate';

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
@@ -10,7 +10,7 @@
1010
import yargs = require('yargs');
1111
import type {Config} from '@jest/types';
1212
import {deprecationEntries} from 'jest-config';
13-
import Runtime = require('jest-runtime');
13+
import Runtime from 'jest-runtime';
1414
import {validateCLIOptions} from 'jest-validate';
1515
import * as args from './args';
1616
const {version: VERSION} = require('../../package.json');

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

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

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

0 commit comments

Comments
 (0)