Closed cagross closed 3 years ago
This probably depends on your build set up, but maybe try this:
import cleanup from 'jsdom-global'
cleanup()
Lemme know if it works!
On Thu, 3 Jun 2021, 10:24 am Carl Gross, @.***> wrote:
Hey I know you can't spend too much time on this project anymore, but I just thought I'd ask, in case there's a relatively quick/easy answer. In the Usage section https://github.com/rstacruz/jsdom-global#usage, it describes a way to cleanup, by calling cleanup like so:
var cleanup = require('jsdom-global')() cleanup()
But what if I'm importing using ES6 modules? Then require is not defined. So is there another way to define cleanup? I tried a few ways, using the import keyword, but couldn't get anything to work :-/
If cleanup is instead something I need to do myself, in a more manual manner, that's fine--just let me know.
— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/rstacruz/jsdom-global/issues/58, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAASFENF7D6IEVLDPSHM33LTQ3DVVANCNFSM457XCTXA .
Yes awesome--that works! Thanks so much, it's a big help.
I'll close this issue then.
Hey I know you can't spend too much time on this project anymore, but I just thought I'd ask, in case there's a relatively quick/easy answer. In the Usage section, it describes a way to cleanup, by calling cleanup like so:
But what if I'm importing using ES6 modules? Then
require
is not defined. So is there another way to definecleanup
? I tried a few ways, using theimport
keyword, but couldn't get anything to work :-/If cleanup is instead something I need to do myself, in a more manual manner, that's fine--just let me know.