-
-
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
TypedArrays Are not typed arrays at runtime #10854
Comments
Likely duplicate of #10786 We're running into the same problem since updating to CRA4 (and hence Jest 26). In our case, it's new Uint8Array(...).buffer instanceof ArrayBuffer being false. @richardspence: Can you try removing this line locally and see if the test will run for you? That did it for me. That line seems suspicious. If it copies ArrayBuffer, it should likely also copy the global Uint8Array, but doesn't. Additionally, in spite of what that comment says, after removing the line, window.ArrayBuffer is still available. |
I got the same problem when using @peculiar/webcrypto as polyfill in jest. Removing the line locally didn't fix it for me. The only thing working for now is using |
As I said in #10786 (comment):
|
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. |
🐛 Bug Report
Latest Jest destructively interferes with TypedArrays at runtime.
To Reproduce
Run this test on Jest 26.*. Reproduced on 26.6.3
test('foo', ()=>{
expect(new Uint8Array(4).buffer instanceof ArrayBuffer).toBe(true);
})
Impact
Not using the real types for typed arrays has trickle down affects like constructing DataViews (who reject input arguments that are not ArrayBuffers).
Expected behavior
The test should pass
Link to repl or repo (highly encouraged)
Repro Link
envinfo
The text was updated successfully, but these errors were encountered: