-
-
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, jsdom and maybe ts-jest trouble with Buffer being an instance of Uint8Array #14363
Comments
Did you try using |
Duplicate of above linked issue |
Thanks for the support. So my goal is to eliminate tech-debt from my project, but adding My main problem being typescript support: nicolo-ribaudo/jest-light-runner#53. Isn't there a better solution? Uint8Array support works when only one test runs, but not multiple. It seems like a problem with jest, but having to setup convoluted scaffolding just to run tests feels like a code smell. |
It's #2549 as mentioned. That issue contains a bunch of different workarounds. |
I solved it by removing jsdom as the default environment and using it on a per test basis |
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.6.1
Steps to reproduce
npm install
npm test
# this shows the tests failingnpm run test:only-one
) # this runs only one test to show that it works with only one filenpm run node:compare
) # this runs a node script to show that a Buffer should be aninstanceof
Uint8Array
Expected behavior
a
Buffer
should be an instance ofUint8Array
when running multiple testsActual behavior
a
Buffer
is not an instance ofUint8Array
when running multiple testsAdditional context
If only one test file is run it works (but not in watch mode).
If 2 files (accessing Uint8Array) are run it fails.
If I remove
jsdom
as test env, it works (but I need it in my origin repo)If I remove ts-jest as a transformer, it sometimes work, but sometimes not (seems to be inconsistent with cache). But I need ts-jest in my origin repo.
A similar issue was reported here: #4422, however while it solves the general problem, the described issue persists.
Environment
The text was updated successfully, but these errors were encountered: