Client testing of Astrojs with Svelte island
curl -fsSL https://deno.land/install.sh | sh
(more installation options)
git clone [email protected]:ambrt/jsdom-astro-svelte.git
cd jsdom-astro-svelte
npm i
npm run test:deno
Results should show content similar to:
Download http://localhost:4321/node_modules/.vite/deps/chunk-L3IDHH4W.js?v=a19ae93c
Download http://localhost:4321/node_modules/.vite/deps/@astrojs_svelte_client__js.js?v=a19ae93c
stdout | test/deno.test.ts > JSDOM > JSDOM with resources
[vite] connecting...
stdout | test/deno.test.ts > JSDOM > JSDOM with resources
after wait
Test: Clicks: 0 OnMount: yes Click Button
stdout | test/deno.test.ts > JSDOM > JSDOM with resources
[vite] connected.
stdout | test/deno.test.ts > JSDOM > JSDOM with resources
Test: Clicks: 1 OnMount: yes Click Button
28.79393600000003
Output Test: Clicks: 1 OnMount: yes
means that
there was 1 click and OnMount:yes
that onMount()
was called and updated the DOM
4321
port so it should be available.deno clean
before the test.Despite using poolOptions
and --experimental-vm-modules
running test npm run test:node
in node v24
throws ERR_VM_DYNAMIC_IMPORT_CALLBACK_MISSING
.