magicrobots
magicrobots4w ago

Test react components, having difficulty with `document global not in Deno` using happy-dom

I've done:
import { Window } from 'happy-dom';

const window = new Window();
const document = window.document;
globalThis.document = document;
import { Window } from 'happy-dom';

const window = new Window();
const document = window.document;
globalThis.document = document;
and still get the error when running deno test --allow-a-bunch-of-stuff document global is not available in Deno. Any idea what I'm missing? Cheers y'all.
2 Replies
toni
toni4w ago
Did you use deno 2? AFAIK, global has been removed from deno 2. You can use latest deno 1.46.3
magicrobots
magicrobotsOP4w ago
Oh interesting, I am using deno 2 - I'll look into how it should be modified. That's good to know thank you

Did you find this page helpful?