File tree Expand file tree Collapse file tree
packages/jest-environment-node/src Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1414
1515### Fixes
1616
17+ - ` [jest-environment-node] ` Add mising globals: TextEncoder and TextDecoder ([ #8022 ] ( https://github.com/facebook/jest/pull/8022 ) )
1718- ` [jest-cli] ` Fix prototype pollution vulnerability in dependency ([ #7904 ] ( https://github.com/facebook/jest/pull/7904 ) )
1819- ` [jest-cli] ` Refactor ` -o ` and ` --coverage ` combined ([ #7611 ] ( https://github.com/facebook/jest/pull/7611 ) )
1920- ` [expect] ` Fix custom async matcher stack trace ([ #7652 ] ( https://github.com/facebook/jest/pull/7652 ) )
Original file line number Diff line number Diff line change @@ -42,6 +42,15 @@ class NodeEnvironment implements JestEnvironment {
4242 global . URL = URL ;
4343 global . URLSearchParams = URLSearchParams ;
4444 }
45+ // TextDecoder and TextDecoder are global in Node >= 11
46+ if (
47+ typeof TextEncoder !== 'undefined' &&
48+ typeof TextDecoder !== 'undefined'
49+ ) {
50+ /* global TextEncoder, TextDecoder */
51+ global . TextEncoder = TextEncoder ;
52+ global . TextDecoder = TextDecoder ;
53+ }
4554 installCommonGlobals ( global , config . globals ) ;
4655 this . moduleMocker = new ModuleMocker ( global ) ;
4756
You can’t perform that action at this time.
0 commit comments