From 8de503ebb4c1ba57606874e44f422238e3cfa1b4 Mon Sep 17 00:00:00 2001 From: BlackGlory Date: Fri, 17 Dec 2021 22:33:10 +0800 Subject: [PATCH 1/2] feat: add AbortSignal for Node >= 15 --- packages/jest-environment-node/src/index.ts | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/packages/jest-environment-node/src/index.ts b/packages/jest-environment-node/src/index.ts index 2f3a433ac391..8fa53d5e0339 100644 --- a/packages/jest-environment-node/src/index.ts +++ b/packages/jest-environment-node/src/index.ts @@ -66,6 +66,10 @@ class NodeEnvironment implements JestEnvironment { if (typeof AbortController !== 'undefined') { global.AbortController = AbortController; } + // AbortSignal is global in Node >= 15 + if (typeof AbortSignal !== 'undefined') { + global.AbortSignal = AbortSignal; + } // Event is global in Node >= 15.4 if (typeof Event !== 'undefined') { global.Event = Event; From b78ef9511044462eb35ef75e7a68ead5ebcba565 Mon Sep 17 00:00:00 2001 From: BlackGlory Date: Fri, 17 Dec 2021 22:39:56 +0800 Subject: [PATCH 2/2] jest-environment-node: Add AbortSignal --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 9330bdf0f1d5..9ebe7e025867 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,7 @@ ### Fixes - `[@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)) ### Chore & Maintenance