Skip to content

Commit 654dbd6

Browse files
authored
refactor!: make it mandatory to pass globalConfig to the Runtime constructor (#15044)
1 parent b028e50 commit 654dbd6

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@
2727
- `[jest-runtime]` Exposing new modern timers function `jest.advanceTimersToFrame()` from `@jest/fake-timers` ([#14598](https://github.com/jestjs/jest/pull/14598))
2828
- `[jest-runtime]` Support `import.meta.filename` and `import.meta.dirname` (available from [Node 20.11](https://nodejs.org/en/blog/release/v20.11.0)) ([#14854](https://github.com/jestjs/jest/pull/14854))
2929
- `[jest-runtime]` Support `import.meta.resolve` ([#14930](https://github.com/jestjs/jest/pull/14930))
30+
- `[jest-runtime]` [**BREAKING**] Make it mandatory to pass `globalConfig` to the `Runtime` constructor ([#15044](https://github.com/jestjs/jest/pull/15044))
3031
- `[@jest/schemas]` Upgrade `@sinclair/typebox` to v0.31 ([#14072](https://github.com/jestjs/jest/pull/14072))
3132
- `[@jest/types]` `test.each()`: Accept a readonly (`as const`) table properly ([#14565](https://github.com/jestjs/jest/pull/14565))
3233
- `[@jest/types]` Improve argument type inference passed to `test` and `describe` callback functions from `each` tables ([#14920](https://github.com/jestjs/jest/pull/14920))

packages/jest-runtime/src/index.ts

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -165,7 +165,7 @@ export default class Runtime {
165165
private readonly _cacheFS: Map<string, string>;
166166
private readonly _cacheFSBuffer = new Map<string, Buffer>();
167167
private readonly _config: Config.ProjectConfig;
168-
private readonly _globalConfig?: Config.GlobalConfig;
168+
private readonly _globalConfig: Config.GlobalConfig;
169169
private readonly _coverageOptions: ShouldInstrumentOptions;
170170
private _currentlyExecutingModulePath: string;
171171
private readonly _environment: JestEnvironment;
@@ -225,8 +225,7 @@ export default class Runtime {
225225
cacheFS: Map<string, string>,
226226
coverageOptions: ShouldInstrumentOptions,
227227
testPath: string,
228-
// TODO: make mandatory in Jest 30
229-
globalConfig?: Config.GlobalConfig,
228+
globalConfig: Config.GlobalConfig,
230229
) {
231230
this._cacheFS = cacheFS;
232231
this._config = config;
@@ -2372,7 +2371,7 @@ export default class Runtime {
23722371
},
23732372
getSeed: () => {
23742373
// TODO: remove this check in Jest 30
2375-
if (this._globalConfig?.seed === undefined) {
2374+
if (this._globalConfig.seed === undefined) {
23762375
throw new Error(
23772376
'The seed value is not available. Likely you are using older versions of the jest dependencies.',
23782377
);

0 commit comments

Comments
 (0)