Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(jest-environment-node): Add structuredClone to globals #12631

Merged
merged 4 commits into from
Apr 4, 2022
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@
- `[jest-environment-jsdom]` Make `jsdom` accessible to extending environments again ([#12232](https://github.com/facebook/jest/pull/12232))
- `[jest-environment-jsdom]` Log JSDOM errors more cleanly ([#12386](https://github.com/facebook/jest/pull/12386))
- `[jest-environment-node]` Add MessageChannel, MessageEvent to globals ([#12553](https://github.com/facebook/jest/pull/12553))
- `[jest-environment-node]` Add structuredClone to globals ([#12631](https://github.com/facebook/jest/pull/12631))
SimenB marked this conversation as resolved.
Show resolved Hide resolved
- `[@jest/expect-utils]` [**BREAKING**] Fix false positives when looking for `undefined` prop ([#8923](https://github.com/facebook/jest/pull/8923))
- `[jest-haste-map]` Don't use partial results if file crawl errors ([#12420](https://github.com/facebook/jest/pull/12420))
- `[jest-jasmine2, jest-types]` [**BREAKING**] Move all `jasmine` specific types from `@jest/types` to its own package ([#12125](https://github.com/facebook/jest/pull/12125))
Expand Down
4 changes: 4 additions & 0 deletions packages/jest-environment-node/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,10 @@ export default class NodeEnvironment implements JestEnvironment<Timer> {
global.atob = atob;
global.btoa = btoa;
}
// structuredClone is global in Node >= 17
if (typeof structuredClone !== 'undefined') {
global.structuredClone = structuredClone;
}
installCommonGlobals(global, projectConfig.globals);

this.moduleMocker = new ModuleMocker(global);
Expand Down