neon-js: ReferenceError: TextEncoder is not defined

image

image

Hi, I used the createScript method to create the script, while it throws the exception with the information of ReferenceError: TextEncoder is not defined.
I use the neon-js-5.0.0-next.7 version which I expect for neo rc1.

About this issue

  • Original URL
  • State: closed
  • Created 3 years ago
  • Comments: 15 (7 by maintainers)

Most upvoted comments

Hi I root caused the problem to be an issue with jest and the environment. You are using jest with the default testEnvironment which is jsdom. There is a bug with jsdom where TextEncoder is not available within the global namespace.

neon-js runs tests with the node environment thus we did not encounter such an issue.

To fix this, you either use a node test environment or amend your global environment with the correct globals.