Skip to content

Commit fee3c6a

Browse files
authored
Add support for AbortController in Jest Node environment with Node v15 (#11182)
1 parent b1764ef commit fee3c6a

File tree

2 files changed

+5
-0
lines changed

2 files changed

+5
-0
lines changed

CHANGELOG.md

+1
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
- `[jest-core]` make `TestWatcher` extend `emittery` ([#10324](https://github.com/facebook/jest/pull/10324))
1313
- `[jest-core]` Run failed tests interactively the same way we do with snapshots ([#10858](https://github.com/facebook/jest/pull/10858))
1414
- `[jest-core]` more `TestSequencer` methods can be async ([#10980](https://github.com/facebook/jest/pull/10980))
15+
- `[jest-environment-node]` Add AbortController to globals ([#11182](https://github.com/facebook/jest/pull/11182))
1516
- `[jest-haste-map]` Handle injected scm clocks ([#10966](https://github.com/facebook/jest/pull/10966))
1617
- `[jest-repl, jest-runner]` [**BREAKING**] Run transforms over environment ([#8751](https://github.com/facebook/jest/pull/8751))
1718
- `[jest-runner]` [**BREAKING**] set exit code to 1 if test logs after teardown ([#10728](https://github.com/facebook/jest/pull/10728))

packages/jest-environment-node/src/index.ts

+4
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,10 @@ class NodeEnvironment implements JestEnvironment {
5959
if (typeof queueMicrotask !== 'undefined') {
6060
global.queueMicrotask = queueMicrotask;
6161
}
62+
// AbortController is global in Node >= 15
63+
if (typeof AbortController !== 'undefined') {
64+
global.AbortController = AbortController;
65+
}
6266
installCommonGlobals(global, config.globals);
6367
this.moduleMocker = new ModuleMocker(global);
6468

0 commit comments

Comments
 (0)