From 1b97264cf5a949d8d4b1e673f0fdf4c449bdee49 Mon Sep 17 00:00:00 2001 From: Simon Siefke Date: Fri, 31 Dec 2021 10:58:42 +0100 Subject: [PATCH] add performance global to nodejs environment (#12002) --- CHANGELOG.md | 1 + packages/jest-environment-node/src/index.ts | 4 ++++ 2 files changed, 5 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index de59fb365eec..772c0304c42e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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 diff --git a/packages/jest-environment-node/src/index.ts b/packages/jest-environment-node/src/index.ts index 8fa53d5e0339..385821e810d4 100644 --- a/packages/jest-environment-node/src/index.ts +++ b/packages/jest-environment-node/src/index.ts @@ -78,6 +78,10 @@ class NodeEnvironment implements JestEnvironment { 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);