-
-
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
expect(...).toEqual(...)
fails on strings encoded with TextEncoder
#9204
Comments
Other libraries ( |
Nah, note that we only strive towards and test total equivalence of |
I've done some investigation on this and it seems that the constructor of the // in Jest (using the node environment)
new TextEncoder().encode('').constructor === Uint8Array // false
// outside Jest (regular node runtime)
new TextEncoder().encode('').constructor === Uint8Array // true I'm not exactly sure why these two are referencing different constructors or where either one of the constructors is referencing a different one, so I'm wondering if anyone has any pointers on this (I'm really curious!). That said, updating the
|
Is this possibly a subset of a larger category of similar issues? I still have this issue in
|
Can you provide a full example? |
Dang it, I am sorry, I used You can re-close this. Sorry to bother you. |
Perfect! No worries 🙂 |
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
To Reproduce
Steps to reproduce the behavior:
npx create-react-app jest-test1 --typescript
package.json
:"test": "react-scripts test --env=node"
(becauseTextEncoder
is not available at all in jsdom)Expected behavior
I expect this test...
...to succeed.
Instead it fails with:
Link to repl or repo (highly encouraged)
https://github.com/cubuspl42/jest-test1
envinfo
The text was updated successfully, but these errors were encountered: