-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
JSDOM 23.0.0 atob endless recursion #4602
Comments
Work-around for now is to provide import { atob as NodeAtob } from "buffer";
globalThis.atob = NodeAtob; Looks like JSDOM now relies on Node's |
There is now a related issue at JSDOM: jsdom/jsdom#3628 which mentions the offending MR in JSDOM: jsdom/jsdom#3625 |
This is an issue with how Vitest overrides globals, so I would expect it to be fixed on our side. Happy-dom also had a similar problem with setTimeout at one point |
As a workaround, You can also do this in your setup file. globalThis.atob = (b64Str: string) => Buffer.from(b64Str, `base64`).toString(`binary`); |
This worked for me, but I had to put the line into a |
Fixed in da7949d |
Describe the bug
We have a test case that uses JSDOM and tests a function that calls "atob".
Since the upgrade to JSDOM 23.0.0, this test hangs.
Reproduction
A very short way to reproduce this is
It yields the error
which is a bit misleading, as JSDOM throws this whenever the global "atob" throws any error.
Adding a 'console.log' statement to JSDOM's "atob" implementation shows that "atob" calls itself, resulting in an endless recursion.
System Info
Used Package Manager
npm
Validations
The text was updated successfully, but these errors were encountered: