ReferenceError: TextEncoder is not defined
See original GitHub issueWhat happened?
While trying to use jose (there https://github.com/PrismarineJS/prismarine-auth/blob/27b324544cacf518023381fe00705c919a95bf4a/src/TokenManagers/XboxTokenManager.js#L8)
we get a ReferenceError: TextEncoder is not defined
See https://github.com/PrismarineJS/node-minecraft-packets/runs/4087042559?check_suite_focus=true
Version
4.1.4
Runtime
Node.js
Runtime Details
node v14.15.1
Code to reproduce
Running this kind of code https://github.com/PrismarineJS/prismarine-auth/blob/27b324544cacf518023381fe00705c919a95bf4a/src/TokenManagers/XboxTokenManager.js#L22 in a jest test
see https://github.com/PrismarineJS/prismarine-auth/issues/10#issuecomment-943371074
I don’t completely get the relationship between jest and jose, but this doesn’t seem to be fully fixed
- I have searched the issues tracker and discussions for similar topics and couldn’t find anything related.
- I agree to follow this project’s Code of Conduct
Issue Analytics
- State:
- Created 2 years ago
- Comments:5 (3 by maintainers)
Top Results From Across the Web
ReferenceError: TextEncoder is not defined - Stack Overflow
A text encoder for Node.js can be found in the util module. You can access it like so: const util = require('util'); const...
Read more >TextEncoder is not defined #209 - jsdom/whatwg-url - GitHub
You need to provide an example that only uses whatwg-url, no other packages, that we can run with node test.js . 👎 34...
Read more >TextEncoder is not defined | NodeJs | MongoDB | Solved
TextEncoder is not definedReference ErrorPath for required filenode_modules/whatwg-url/encoding.jsThanks# TextEncoder #mongodb #nodejs.
Read more >Node.js TextEncoder - GeeksforGeeks
The TextEncoder class does not inherit any property. Only one property is defined which is: TextEncoder.prototype.encoding: It is a read-only ...
Read more >TextEncoder is not defined Node.js with mongoose-mongodb
Coding example for the question ReferenceError: TextEncoder is not defined Node.js with mongoose-mongodb.
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
I’m not going to invest time in solving jsdom/jest issues not introduced here. See https://github.com/jsdom/jsdom/issues/2524 for possibly finding a workaround.
@panva is there any solution with
testEnvironment : jsdom
? in my project, if i change thetestEnvironment
tonode
, all tests will be error.