Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

vitest and isolted-vm incompatible? #481

Open
ludusrusso opened this issue Jul 4, 2024 · 1 comment
Open

vitest and isolted-vm incompatible? #481

ludusrusso opened this issue Jul 4, 2024 · 1 comment

Comments

@ludusrusso
Copy link

I'm having some problems running isolated-vm inside a vitest test after upgrading to node 20.

With node 18.x it works well, after switching to node v20 I have a segmentation fault [1] 2778 segmentation fault pnpm run test

Quite sure this is releated with --no-node-snapshot but it seems it is incompatible with vitest.
I've read the docs of vitest and it seems is not possible to de-opt from vitest js vm.

This is what happens when I run vitest with NODE_OPTIONS=--no-node-snapshot

Error: Initiated Worker with invalid NODE_OPTIONS env variable: --no-node-snapshot is not allowed in NODE_OPTIONS
 ❯ new Worker node:internal/worker:225:13
 ❯ ThreadWorker.initialize ../../node_modules/.pnpm/[email protected]/node_modules/tinypool/dist/esm/index.js:139:19
 ❯ ThreadPool._addNewWorker ../../node_modules/.pnpm/[email protected]/node_modules/tinypool/dist/esm/index.js:678:12
 ❯ ThreadPool._ensureMinimumWorkers ../../node_modules/.pnpm/[email protected]/node_modules/tinypool/dist/esm/index.js:663:12
 ❯ new ThreadPool ../../node_modules/.pnpm/[email protected]/node_modules/tinypool/dist/esm/index.js:648:10
 ❯ new Tinypool ../../node_modules/.pnpm/[email protected]/node_modules/tinypool/dist/esm/index.js:950:31
 ❯ createThreadsPool ../../node_modules/.pnpm/[email protected]_@[email protected]/node_modules/vitest/dist/vendor/cac.qnW6GNL2.js:8776:16
 ❯ threads ../../node_modules/.pnpm/[email protected]_@[email protected]/node_modules/vitest/dist/vendor/cac.qnW6GNL2.js:9425:22
 ❯ ../../node_modules/.pnpm/[email protected]_@[email protected]/node_modules/vitest/dist/vendor/cac.qnW6GNL2.js:9450:39

⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯
Serialized Error: { code: 'ERR_WORKER_INVALID_EXEC_ARGV' }
@laverdet
Copy link
Owner

laverdet commented Jul 5, 2024

This is a bug in vitest. They should not be naively passing NODE_OPTIONS into Worker like this. If you can somehow delete process.env.NODE_OPTIONS then it will probably work. Or you can run vitest via: node --no-node-snapshot node_modules/vitest/dist/cli-wrapper.js. But I think you might run into more problems.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants