Open birkskyum opened 1 week ago
Looking into this, all things point to a resolution error with import conditions of an npm package. We're loading solid-js/dist/server.js
whereas Node never loads this. Like most frameworks solid resolves to a different entry for server-side rendering compared to rendering in the browser. For some reason we're pulling in the browser render code. Not yet sure why.
Found the root problem and was able to create a minimal reproduction case. The issue is that we're ignoring the execArgv
argument passed to Workers from Node's worker_threads
. Node has a --conditions
argument which allows you to override the export conditions to pick in package.json
. Vitest and by extension the solid testing library overrides that so that it will pick a specific entry when importing solid-js/web
in a test suite.
deno run -A main.mjs
Version: Deno 2.0.3
Repro:
deno run -A npm:create-solid
deno i
deno task test
Vitest 1.6.0
Error:
Deno fails - vitest 1.6.0
``` ➜ deno task test Task test vitest run RUN v1.6.0 ❯ src/components/Counter.test.tsx (1 test | 1 failed) 4ms ❯ src/components/Counter.test.tsx >Now trying to run in same folder with
npm run test
,bun run test
ornode --run test
(Node 22) does workNpm works - vitest 1.6.0
```sh ➜ npm run test > test > vitest run RUN v1.6.0 ✓ src/components/Counter.test.tsx (1) ✓Vitest 2.1.3 - Same thing
Tried updating the Vitest to 2.x
"vitest": "^2.0.0"
(upstream PR), and it's the same result:Deno fails - vitest 2.1.3
``` ➜ deno task test Task test vitest run RUN v2.1.3 ❯ src/components/Counter.test.tsx (1) ❯with npm it works
Npm works - vitest 2.1.3
``` ➜ npm run test > test > vitest run RUN v2.1.3 (node:99528) [DEP0040] DeprecationWarning: The `punycode` module is deprecated. Please use a userland alternative instead. (Use `node --trace-deprecation ...` to show where the warning was created) stdout | src/components/Counter.test.tsx >