Skip to content

Commit

Permalink
add performance global to nodejs environment (#12002)
Browse files Browse the repository at this point in the history
  • Loading branch information
SimonSiefke authored Dec 31, 2021
1 parent 987e415 commit 1b97264
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 0 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@

- `[@jest/transform]` Update dependency package `pirates` to 4.0.4 ([#12136](https://github.com/facebook/jest/pull/12136))
- `[jest-environment-node]` Add `AbortSignal` ([#12157](https://github.com/facebook/jest/pull/12157))
- `[jest-environment-node]` Add Missing node global `performance` ([#12002](https://github.com/facebook/jest/pull/12002))

### Chore & Maintenance

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 @@ -78,6 +78,10 @@ class NodeEnvironment implements JestEnvironment<Timer> {
if (typeof EventTarget !== 'undefined') {
global.EventTarget = EventTarget;
}
// performance is global in Node >= 16
if (typeof performance !== 'undefined') {
global.performance = performance;
}
installCommonGlobals(global, config.globals);

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

0 comments on commit 1b97264

Please sign in to comment.