Jest error: ReferenceError: self is not defined
See original GitHub issueIn the latest version of the library, we get the following error when using jest:
ReferenceError: self is not defined
4 | import { findWithType } from 'react-shallow-testutils';
5 | import ShallowRenderer from 'react-test-renderer/shallow';
> 6 | import WaveSurfer from 'wavesurfer.js';
| ^
This was caused by a change removing globalObject: 'this'
from the build config in https://github.com/katspaugh/wavesurfer.js/commit/d27b75e29b16e1b0d425eefa83bd0b0e1891f067.
There is a workaround by setting testEnvironment: 'jsdom'
in the jest config, but this causes issues for things in the node environment.
Issue Analytics
- State:
- Created 2 years ago
- Reactions:1
- Comments:15
Top Results From Across the Web
Jest fails with 'self is not defined' when importing react-diagrams
Jest fails with 'self is not defined' when importing react-diagrams ; import { DiagramModel } ; ReferenceError: self is not defined > 1...
Read more >'Server Error: Self is Not Defined' When Used During SSR
When used in an SSR build (NextJS in this case) the following error is thrown: Server Error ReferenceError: self is not defined.
Read more >Getting "Reference Error: self is not defined" - plotly.js
Hello. I have been trying to use plotly charts in React. I have defined the component given below, and have used it simply...
Read more >Error 'self is not defined' when using in Jest test - Bountysource
Im trying to create a basic jest test interacting with react-diagrams classes. The failing test.
Read more >ReferenceError: self is not defined - MongoDB
I'm using mongodb-stitch-browser-sdk 4.8.0. I'm simply trying to import Stitch using this code…
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 FreeTop 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
Top GitHub Comments
Did not really work.
Anyone who is looking for a Next.js solution, use the dynamic loader to load your component that contains the wavesurfer import:
Same here with Vue/Nuxt