You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
vitest fails when using node v18.17.0 - TypeError: The "path" argument must be of type string or an instance of Buffer or URL. Received an instance of URL
#3826
Closed
6 tasks done
sandrosc opened this issue
Jul 27, 2023
· 3 comments
· Fixed by #3828
FAIL test/App.test.tsx [ test/App.test.tsx ]
TypeError: The "path" argument must be of type string or an instance of Buffer or URL. Received an instance of URL
❯ Object.openSync node:fs:595:10
❯ readFileSync node:fs:471:35
❯ node_modules/vitest/node_modules/vite/dist/node/constants.js:5:32
Serialized Error: {
"code": "ERR_INVALID_ARG_TYPE",
}
Test Files 1 failed (1)
Tests no tests
Start at 16:23:56
Duration 1.23s (transform 28ms, setup 0ms, collect 0ms, tests 0ms, environment 620ms, prepare 119ms)
Apparently node v18.17.0 comes with a new URL parser, which might explain why the check if the path argument is an URL fails. This might also be a node issue. We fixed it by upgrading to node v20, but downgrading should also work.
Reproduction
Run vitest with a test on node v18.17.0.
System Info
This issue first occurred in a github action workflow:
- ubuntu-latest github image
- actions/setup-node@v3 with node-version 18
This only fails on jsdom. The URL instance passed to readFileSync makes Node throw an error now. Vitest test environments node and happy-dom work fine.
Describe the bug
Apparently node v18.17.0 comes with a new URL parser, which might explain why the check if the path argument is an URL fails. This might also be a node issue. We fixed it by upgrading to node v20, but downgrading should also work.
Reproduction
Run vitest with a test on node v18.17.0.
System Info
This issue first occurred in a github action workflow: - ubuntu-latest github image - actions/setup-node@v3 with node-version 18
Used Package Manager
yarn
Validations
The text was updated successfully, but these errors were encountered: