Another thing you can try is instantiating JSDOM before you import any test files. For Jasmine, you can create a helper (which is simply an file thatβs loaded) and register it in spec/support/jasmine.json.
Jest does this implicitly because it has the notion of an βenvironmentβ in which your tests run, and the standard environment is a JSDOM environment.
I donβt really like this approach as not all test files require JSDOM, but it might solve this problem? Itβs worth trying.
Oh, of course. I should have thought of that. Youβll need to take that one function, create a new file with just that, and convert import -> require. I can try it myself tomorrow
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
Another thing you can try is instantiating JSDOM before you import any test files. For Jasmine, you can create a helper (which is simply an file thatβs loaded) and register it in
spec/support/jasmine.json
.Jest does this implicitly because it has the notion of an βenvironmentβ in which your tests run, and the standard environment is a JSDOM environment.
I donβt really like this approach as not all test files require JSDOM, but it might solve this problem? Itβs worth trying.
Would I then import the JSDOM into svelte.js? helpers don't seem to be ES6 compatible so this is causing me some syntax errors.
Oh, of course. I should have thought of that. Youβll need to take that one function, create a new file with just that, and convert import -> require. I can try it myself tomorrow