-
-
Notifications
You must be signed in to change notification settings - Fork 6.5k
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
[Bug]: jest-environment-jsdom messes with global Uint8Array #13227
Comments
Ok, after reading #9983 I don't imagine this will get fixed. Closing proactively |
Yeah, the issue is that nodejs/node#31852 would also fix your If you really want to check the type in the test, you can use https://nodejs.org/api/util.html#utiltypesisuint8arrayvalue which works cross-realm. diff --git i/index.spec.js w/index.spec.js
index 477703f..491cb60 100644
--- i/index.spec.js
+++ w/index.spec.js
@@ -2,5 +2,5 @@ const util = require("util");
test("repro", async () => {
const encoder = new util.TextEncoder();
- expect(encoder.encode("€")).toBeInstanceOf(Uint8Array);
+ expect(util.types.isUint8Array(encoder.encode("€"))).toBe(true);
}); This works for both node and jsdom envs. |
Yep, thank you!
Not really, another library crashed on |
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. |
Version
29.0.2
Steps to reproduce
yarn && yarn test
testEnvironment: "jest-environment-jsdom",
from 'jest.config.js'Expected behavior
The test should pass,
jsdom
shouldn't touchUint8Array
if it exists in global scopeActual behavior
the test fails,
jsdom
seems to have overwrittenUint8Array
Additional context
No response
Environment
The text was updated successfully, but these errors were encountered: