Skip to content

Commit

Permalink
fix(jest-environment-node): Add MessageChannel, MessageEvent to globa…
Browse files Browse the repository at this point in the history
…ls (#12553)
  • Loading branch information
F3n67u committed Mar 7, 2022
1 parent 66408c3 commit f52840d
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Expand Up @@ -54,6 +54,7 @@
- `[jest-each]` `%#` is not replaced with index of the test case ([#12517](https://github.com/facebook/jest/pull/12517))
- `[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/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
8 changes: 8 additions & 0 deletions packages/jest-environment-node/src/index.ts
Expand Up @@ -78,6 +78,14 @@ export default class NodeEnvironment implements JestEnvironment<Timer> {
if (typeof EventTarget !== 'undefined') {
global.EventTarget = EventTarget;
}
// MessageChannel is global in Node >= 15
if (typeof MessageChannel !== 'undefined') {
global.MessageChannel = MessageChannel;
}
// MessageEvent is global in Node >= 15
if (typeof MessageEvent !== 'undefined') {
global.MessageEvent = MessageEvent;
}
// performance is global in Node >= 16
if (typeof performance !== 'undefined') {
global.performance = performance;
Expand Down

0 comments on commit f52840d

Please sign in to comment.