Skip to content

Commit

Permalink
refactor!: make it mandatory to pass globalConfig to the Runtime
Browse files Browse the repository at this point in the history
…constructor (#15044)
  • Loading branch information
mrazauskas committed Apr 30, 2024
1 parent b028e50 commit 654dbd6
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
- `[jest-runtime]` Exposing new modern timers function `jest.advanceTimersToFrame()` from `@jest/fake-timers` ([#14598](https://github.com/jestjs/jest/pull/14598))
- `[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))
- `[jest-runtime]` Support `import.meta.resolve` ([#14930](https://github.com/jestjs/jest/pull/14930))
- `[jest-runtime]` [**BREAKING**] Make it mandatory to pass `globalConfig` to the `Runtime` constructor ([#15044](https://github.com/jestjs/jest/pull/15044))
- `[@jest/schemas]` Upgrade `@sinclair/typebox` to v0.31 ([#14072](https://github.com/jestjs/jest/pull/14072))
- `[@jest/types]` `test.each()`: Accept a readonly (`as const`) table properly ([#14565](https://github.com/jestjs/jest/pull/14565))
- `[@jest/types]` Improve argument type inference passed to `test` and `describe` callback functions from `each` tables ([#14920](https://github.com/jestjs/jest/pull/14920))
Expand Down
7 changes: 3 additions & 4 deletions packages/jest-runtime/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@ export default class Runtime {
private readonly _cacheFS: Map<string, string>;
private readonly _cacheFSBuffer = new Map<string, Buffer>();
private readonly _config: Config.ProjectConfig;
private readonly _globalConfig?: Config.GlobalConfig;
private readonly _globalConfig: Config.GlobalConfig;
private readonly _coverageOptions: ShouldInstrumentOptions;
private _currentlyExecutingModulePath: string;
private readonly _environment: JestEnvironment;
Expand Down Expand Up @@ -225,8 +225,7 @@ export default class Runtime {
cacheFS: Map<string, string>,
coverageOptions: ShouldInstrumentOptions,
testPath: string,
// TODO: make mandatory in Jest 30
globalConfig?: Config.GlobalConfig,
globalConfig: Config.GlobalConfig,
) {
this._cacheFS = cacheFS;
this._config = config;
Expand Down Expand Up @@ -2372,7 +2371,7 @@ export default class Runtime {
},
getSeed: () => {
// TODO: remove this check in Jest 30
if (this._globalConfig?.seed === undefined) {
if (this._globalConfig.seed === undefined) {
throw new Error(
'The seed value is not available. Likely you are using older versions of the jest dependencies.',
);
Expand Down

0 comments on commit 654dbd6

Please sign in to comment.