Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@

### Fixes

- `[jest-environment-node]` Add mising globals: TextEncoder and TextDecoder ([#8022](https://github.com/facebook/jest/pull/8022))
- `[jest-cli]` Fix prototype pollution vulnerability in dependency ([#7904](https://github.com/facebook/jest/pull/7904))
- `[jest-cli]` Refactor `-o` and `--coverage` combined ([#7611](https://github.com/facebook/jest/pull/7611))
- `[expect]` Fix custom async matcher stack trace ([#7652](https://github.com/facebook/jest/pull/7652))
Expand Down
9 changes: 9 additions & 0 deletions packages/jest-environment-node/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,15 @@ class NodeEnvironment implements JestEnvironment {
global.URL = URL;
global.URLSearchParams = URLSearchParams;
}
// TextDecoder and TextDecoder are global in Node >= 11
if (
typeof TextEncoder !== 'undefined' &&
typeof TextDecoder !== 'undefined'
) {
/* global TextEncoder, TextDecoder */
global.TextEncoder = TextEncoder;
global.TextDecoder = TextDecoder;
}
installCommonGlobals(global, config.globals);
this.moduleMocker = new ModuleMocker(global);

Expand Down