vitest-dev / vitest-dev/vitest
File not found after update Vitest but work on old versions
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 17.1k
- Forks
- 2k
- Avg merge
- 1d 22h
- Merged PRs (30d)
- 94
Description
Describe the bug
Hi,
I have a test where i need load a .wasm file and it is outside my web project.
It was built in /Users/paulo/Developer/workspaces/cpp/xplpc/build/wasm/wasm32/bin/xplpc.wasm and the web project to test is /Users/paulo/Developer/workspaces/cpp/xplpc/wasm/sample.
The project is here:
https://github.com/xplpc/xplpc
My test is:
[...]
import Module from "@xplpc/build/wasm/wasm32/bin/xplpc";
describe("Client", () => {
beforeAll(async () => {
// initialize module
const module: IXWasmModule = await Module();
XPLPC.shared().initialize(module, new XConfig(new JsonSerializer()));
});
[...]
On vitest 0.29.3 my test works well because @xplpc is a mapping to project root (tsconfig.json and vite.config.ts) /Users/paulo/Developer/workspaces/cpp/xplpc and the xplpc.wasm file and xplpc.js is found.
But after update to vitest version 3.2.4 i start receive error:
=============
stderr | tests/unit/client.spec.ts > Client
failed to asynchronously prepare wasm: Error: ENOENT: no such file or directory, open 'http://localhost:3000/@fs/Users/paulo/Developer/workspaces/cpp/xplpc/build/wasm/wasm32/bin/xplpc.wasm'
Aborted(Error: ENOENT: no such file or directory, open 'http://localhost:3000/@fs/Users/paulo/Developer/workspaces/cpp/xplpc/build/wasm/wasm32/bin/xplpc.wasm')
❯ tests/unit/client.spec.ts (12 tests | 12 skipped) 12ms
↓ Client > check if is initialized
↓ Client > battery level
↓ Client > battery level from string
↓ Client > battery level from string with await
↓ Client > get logged value
↓ Client > get logged value with await
↓ Client > get reverse value
↓ Client > get reverse value with await
↓ Client > transfer data view
↓ Client > transfer data view with await
↓ Client > receive data view
↓ Client > receive data view with await
✓ tests/unit/pages.spec.ts (1 test) 11ms
⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯ Failed Suites 1 ⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯
FAIL tests/unit/client.spec.ts > Client
RuntimeError: Aborted(Error: ENOENT: no such file or directory, open 'http://localhost:3000/@fs/Users/paulo/Developer/workspaces/cpp/xplpc/build/wasm/wasm32/bin/xplpc.wasm')
❯ abort ../../build/wasm/wasm32/bin/xplpc.js:8:10177
❯ instantiateArrayBuffer ../../build/wasm/wasm32/bin/xplpc.js:8:12222
❯ createWasm ../../build/wasm/wasm32/bin/xplpc.js:8:13811
❯ ../../build/wasm/wasm32/bin/xplpc.js:8:81025
❯ tests/unit/client.spec.ts:32:38
⎯⎯⎯⎯⎯⎯⎯⎯⎯ Unhandled Errors ⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯
Vitest caught 1 unhandled error during the test run.
This might cause false positive tests. Resolve unhandled errors to make sure your tests are not affected.
⎯⎯⎯⎯⎯⎯⎯⎯ Unhandled Rejection ⎯⎯⎯⎯⎯⎯⎯⎯
RuntimeError: Aborted(Error: ENOENT: no such file or directory, open 'http://localhost:3000/@fs/Users/paulo/Developer/workspaces/cpp/xplpc/build/wasm/wasm32/bin/xplpc.wasm')
❯ abort ../../build/wasm/wasm32/bin/xplpc.js:8:10177
❯ instantiateArrayBuffer ../../build/wasm/wasm32/bin/xplpc.js:8:12222
❯ processTicksAndRejections node:internal/process/task_queues:105:5
❯ createWasm ../../build/wasm/wasm32/bin/xplpc.js:8:13811
❯ ../../build/wasm/wasm32/bin/xplpc.js:8:81025
❯ tests/unit/client.spec.ts:32:38
This error originated in "tests/unit/client.spec.ts" test file. It doesn't mean the error was thrown inside the file itself, but while it was running.
It try load the file from http://localhost:3000/@fs.
Full error log: https://github.com/xplpc/xplpc/actions/runs/15764432959/job/44437922762#step:12:93
Reproduction
Steps:
git clone https://github.com/xplpc/xplpc.git
cd xplpc
git checkout jun-updates
./emsdk activate
python3 xplpc.py wasm-build
python3 xplpc.py wasm-test
If don't want build the wasm file, get the latest build below and put on build/wasm/wasm32/bin:
System Info
System:
OS: macOS 15.3.1
CPU: (10) arm64 Apple M1 Pro
Memory: 88.97 MB / 16.00 GB
Shell: 5.9 - /bin/zsh
Binaries:
Node: 23.9.0 - /opt/homebrew/bin/node
npm: 10.9.2 - /opt/homebrew/bin/npm
bun: 1.2.8 - ~/Library/Application Support/reflex/bun/bin/bun
Browsers:
Chrome: 137.0.7151.120
Safari: 18.3
npmPackages:
@vitejs/plugin-vue: ^5.2.3 => 5.2.3
vite: ^6.3.5 => 6.3.5
vitest: ^3.2.4 => 3.2.4
Used Package Manager
npm
Validations
- Follow our Code of Conduct
- Read the Contributing Guidelines.
- Read the docs.
- Check that there isn't already an issue that reports the same bug to avoid creating a duplicate.
- Check that this is a concrete bug. For Q&A open a GitHub Discussion or join our Discord Chat Server.
- The provided reproduction is a minimal reproducible example of the bug.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the reproduction commands in the issue and compare the behavior between Vitest 0.29.3 and 3.2.4. Inspect tests/unit/client.spec.ts, tsconfig.json, vite.config.ts, and the generated build/wasm/wasm32/bin/xplpc.js and xplpc.wasm paths. Done means wasm-test completes and client.spec.ts runs without the ENOENT error or skipped tests.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- typescript, vite, wasm
- Domain
- build-system, testing-qa
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 30/100