Skip to content

Commit

Permalink
jest-environment-node: Add AbortSignal (#12157)
Browse files Browse the repository at this point in the history
  • Loading branch information
BlackGlory committed Dec 20, 2021
1 parent b6c56de commit cc15e74
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 0 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Expand Up @@ -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

Expand Down
4 changes: 4 additions & 0 deletions packages/jest-environment-node/src/index.ts
Expand Up @@ -66,6 +66,10 @@ class NodeEnvironment implements JestEnvironment<Timer> {
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;
Expand Down

0 comments on commit cc15e74

Please sign in to comment.