Skip to content

Commit

Permalink
Add support for AbortController in Jest Node environment with Node v15 (
Browse files Browse the repository at this point in the history
  • Loading branch information
alehuo committed Mar 11, 2021
1 parent b1764ef commit fee3c6a
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 @@ -12,6 +12,7 @@
- `[jest-core]` make `TestWatcher` extend `emittery` ([#10324](https://github.com/facebook/jest/pull/10324))
- `[jest-core]` Run failed tests interactively the same way we do with snapshots ([#10858](https://github.com/facebook/jest/pull/10858))
- `[jest-core]` more `TestSequencer` methods can be async ([#10980](https://github.com/facebook/jest/pull/10980))
- `[jest-environment-node]` Add AbortController to globals ([#11182](https://github.com/facebook/jest/pull/11182))
- `[jest-haste-map]` Handle injected scm clocks ([#10966](https://github.com/facebook/jest/pull/10966))
- `[jest-repl, jest-runner]` [**BREAKING**] Run transforms over environment ([#8751](https://github.com/facebook/jest/pull/8751))
- `[jest-runner]` [**BREAKING**] set exit code to 1 if test logs after teardown ([#10728](https://github.com/facebook/jest/pull/10728))
Expand Down
4 changes: 4 additions & 0 deletions packages/jest-environment-node/src/index.ts
Expand Up @@ -59,6 +59,10 @@ class NodeEnvironment implements JestEnvironment {
if (typeof queueMicrotask !== 'undefined') {
global.queueMicrotask = queueMicrotask;
}
// AbortController is global in Node >= 15
if (typeof AbortController !== 'undefined') {
global.AbortController = AbortController;
}
installCommonGlobals(global, config.globals);
this.moduleMocker = new ModuleMocker(global);

Expand Down

0 comments on commit fee3c6a

Please sign in to comment.