Skip to content

Commit

Permalink
jest-environment-node: Add queueMicrotask (#9140)
Browse files Browse the repository at this point in the history
* Add global.queueMicrotask

Fix #9139

* jest-environment-node: Add queueMicrotask
  • Loading branch information
BlackGlory authored and SimenB committed Nov 6, 2019
1 parent 8da17b9 commit 2f793b8
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 0 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
- `[jest-diff]` Add `firstOrLastEmptyLineReplacement` option and export 3 `diffLines` functions ([#8955](https://github.com/facebook/jest/pull/8955))
- `[jest-environment-jsdom]` Add `fakeTimersLolex` ([#8925](https://github.com/facebook/jest/pull/8925))
- `[jest-environment-node]` Add `fakeTimersLolex` ([#8925](https://github.com/facebook/jest/pull/8925))
- `[jest-environment-node]` Add `queueMicrotask` ([#9140](https://github.com/facebook/jest/pull/9140))
- `[@jest/fake-timers]` Add Lolex as implementation of fake timers ([#8897](https://github.com/facebook/jest/pull/8897))
- `[jest-get-type]` Add `BigInt` support. ([#8382](https://github.com/facebook/jest/pull/8382))
- `[jest-matcher-utils]` Add `BigInt` support to `ensureNumbers` `ensureActualIsNumber`, `ensureExpectedIsNumber` ([#8382](https://github.com/facebook/jest/pull/8382))
Expand Down
4 changes: 4 additions & 0 deletions packages/jest-environment-node/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,10 @@ class NodeEnvironment implements JestEnvironment {
global.TextEncoder = TextEncoder;
global.TextDecoder = TextDecoder;
}
// queueMicrotask is global in Node >= 11
if (typeof queueMicrotask !== 'undefined') {
global.queueMicrotask = queueMicrotask;
}
installCommonGlobals(global, config.globals);
this.moduleMocker = new ModuleMocker(global);

Expand Down

0 comments on commit 2f793b8

Please sign in to comment.