You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
mkdir jestRepro
cd jestRepro
npm i jest
mkdir testecho'it("should decode base64",()=>expect(atob("MA==")).toBe("0"))'> test/atob.test.js
npx jest
Expected behavior
Same as with --env=jsdom:
PASS test/atob.test.js
✓ should decode base64 (2 ms)
Test Suites: 1 passed, 1 total
Tests: 1 passed, 1 total
Snapshots: 0 total
Time: 0.972 s, estimated 1 s
Ran all test suites.
Actual behavior
FAIL test/atob.test.js
✕ should decode base64 (1 ms)
● should encode to base64
ReferenceError: atob is not defined
> 1 | it("should encode to base64",()=>expect(atob("MA==")).toBe("0"))
| ^
2 |
at Object.<anonymous> (test/atob.test.js:1:1)
Test Suites: 1 failed, 1 total
Tests: 1 failed, 1 total
Snapshots: 0 total
Time: 0.261 s, estimated 1 s
Ran all test suites.
Additional context
atob and btoa are available as globals since Node.js 16.0.0, I think Jest should leave them available as well.
This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.
Please note this issue tracker is not a help forum. We recommend using StackOverflow or our discord channel for questions.
Version
27.4.7
Steps to reproduce
Expected behavior
Same as with
--env=jsdom
:Actual behavior
Additional context
atob
andbtoa
are available as globals since Node.js 16.0.0, I think Jest should leave them available as well.Environment
System: OS: macOS 12.0.1 CPU: (16) x64 Intel(R) Core(TM) i9-9880H CPU @ 2.30GHz Binaries: Node: 17.4.0 - /usr/local/bin/node Yarn: 1.22.17 - /usr/local/bin/yarn npm: 8.3.1 - /usr/local/bin/npm npmPackages: jest: ^27.4.7 => 27.4.7
The text was updated successfully, but these errors were encountered: