You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I tried a few versions back in jsdom -- just in case it was that. But get same style failure up to versions 1y old, too, eg:
deno eval 'import { JSDOM } from "https://esm.sh/[email protected]"; new JSDOM("<!DOCTYPE html><html><body></body></html>")'
I'm using latest v1.26.1 of deno. Any help appreciated! I'd love to convert my work codebase jest-based (a fair amount using jsdom) from node to deno. (I tried import { DOMParser } from 'https://deno.land/x/deno_dom/deno-dom-wasm.ts'; too. And that is working decently for some of the testing -- but we could use a more complete DOM fake for some tests (eg: form submitting, etc.)
Full example here:
> cat deno.jsonc;
{
"compilerOptions": {
"lib": [
"deno.ns",
"dom",
"dom.iterable",
"dom.asynciterable"
]
}
}
> cat jsdom.js
import { JSDOM } from "https://esm.sh/jsdom";
import { assert } from "https://deno.land/[email protected]/testing/asserts.ts";
const { window: { document } } = new JSDOM(
`<!DOCTYPE html>
<html lang="en">
<head>
<title>Hello from Deno</title>
</head>
<body>
<h1>Hello from Deno</h1>
<form>
<input name="user">
<button>
Submit
</button>
</form>
</body>
</html>`,
{
url: "https://example.com/",
referrer: "https://example.org/",
contentType: "text/html",
storageQuota: 10000000,
},
);
const h1 = document.querySelector("h1");
assert(h1);
console.log(h1.textContent);
> deno run -A jsdom.js
error: Uncaught Error: Not implemented: isContext
throw new Error(message);
^
at notImplemented (https://deno.land/[email protected]/node/_utils.ts:23:9)
at Object.isContext (https://deno.land/[email protected]/node/vm.ts:62:3)
at new Sme (https://esm.sh/v96/[email protected]/deno/jsdom.js:800:8449)
at iY.createWindow (https://esm.sh/v96/[email protected]/deno/jsdom.js:800:6192)
at new py (https://esm.sh/v96/[email protected]/deno/jsdom.js:800:23482)
at file:///Users/tracey/av/jsdom.js:4:34
The text was updated successfully, but these errors were encountered:
This is super weird. From what the error message looks like to me, it seems like it's trying to call node:vm which (as stated in the deno manual) is not going to be supported:
Node has some built-in modules (e.g. like vm) that are effectively incompatible with the scope of Deno and therefore there aren't easy ways to provide a polyfill of the functionality in Deno.
The way I see it, this example could never have worked (assuming it truly does try to access node:vm which is not a guarantee). Definitely worth a review.
Using the manual example for:
https://github.com/denoland/manual/blob/v1.26.1/jsx_dom/jsdom.md
I get:
error: Uncaught Error: Not implemented: isContext
throw new Error(message);
^
at notImplemented (https://deno.land/[email protected]/node/_utils.ts:23:9)
at Object.isContext (https://deno.land/[email protected]/node/vm.ts:62:3)
at new Sme (https://esm.sh/v96/[email protected]/deno/jsdom.js:800:8449)
at iY.createWindow (https://esm.sh/v96/[email protected]/deno/jsdom.js:800:6192)
at new py (https://esm.sh/v96/[email protected]/deno/jsdom.js:800:23482)
at file:///Users/tracey/av/jsdom.js:4:34
I tried a few versions back in
jsdom
-- just in case it was that. But get same style failure up to versions 1y old, too, eg:I'm using latest v1.26.1 of deno. Any help appreciated! I'd love to convert my work codebase
jest
-based (a fair amount usingjsdom
) fromnode
todeno
. (I triedimport { DOMParser } from 'https://deno.land/x/deno_dom/deno-dom-wasm.ts';
too. And that is working decently for some of the testing -- but we could use a more complete DOM fake for some tests (eg: form submitting, etc.)Full example here:
The text was updated successfully, but these errors were encountered: