vitest
vitest copied to clipboard
network imports not working on `vmThreads` and `vmForks` pools
Describe the bug
Related to
- https://github.com/vitest-dev/vitest/issues/4949
- https://github.com/vitest-dev/vitest/pull/4987#discussion_r1455182005
Non-VM pools should be working after https://github.com/vitest-dev/vitest/pull/4987, but VM pool seems to have a problem since it relies on custom import handler, which doesn't support pulling modules for network I suppose:
https://github.com/vitest-dev/vitest/blob/39814357024e96b81546ec22d6aaf777b8db6cef/packages/vitest/src/runtime/external-executor.ts#L38
Reproduction
Can be reproduced on Vitest repo via:
$ pnpm -C test/network-imports test -- --pool vmThreads
...
FAIL test/basic.test.ts [ test/basic.test.ts ]
Error: ENOENT: no such file or directory, open 'http://localhost:9602/[email protected]'
❯ Object.openSync node:fs:596:3
❯ readFileSync node:fs:464:35
⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯
Serialized Error: { errno: -2, syscall: 'open', code: 'ENOENT', path: 'http://localhost:9602/[email protected]' }
⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯[1/1]⎯
(Actually --experimental-network-imports is irrelevant for VM since import is based on custom implementation)
https://github.com/vitest-dev/vitest/blob/6421c2766c364a9dd37dabac432f792ff1ecc556/test/network-imports/vitest.config.ts#L12-L19
System Info
System:
OS: Linux 6.6 Arch Linux
CPU: (12) x64 AMD Ryzen 5 5625U with Radeon Graphics
Memory: 1.86 GB / 14.98 GB
Container: Yes
Shell: 5.2.21 - /bin/bash
Binaries:
Node: 18.19.0 - ~/.volta/tools/image/node/18.19.0/bin/node
Yarn: 1.22.19 - ~/.volta/tools/image/yarn/1.22.19/bin/yarn
npm: 10.2.3 - ~/.volta/tools/image/node/18.19.0/bin/npm
pnpm: 8.10.3 - ~/.volta/tools/image/node/18.19.0/bin/pnpm
Browsers:
Chromium: 120.0.6099.216
npmPackages:
@vitest/browser: workspace:* => 1.2.1
@vitest/coverage-istanbul: workspace:* => 1.2.1
@vitest/coverage-v8: workspace:* => 1.2.1
@vitest/ui: workspace:* => 1.2.1
vite: ^5.0.0 => 5.0.2
vitest: workspace:* => 1.2.1
Used Package Manager
pnpm
Validations
- [X] Follow our Code of Conduct
- [X] Read the Contributing Guidelines.
- [X] Read the docs.
- [X] Check that there isn't already an issue that reports the same bug to avoid creating a duplicate.
- [X] Check that this is a concrete bug. For Q&A open a GitHub Discussion or join our Discord Chat Server.
- [X] The provided reproduction is a minimal reproducible example of the bug.