vitest
vitest copied to clipboard
[TypeError] junit reporter with yarn3 PnP fails
Describe the bug
When using yarn3 PnP and specify a junit
reporter there is the following error.
yarn vitest run --reporter junit --outputFile ./junit.xml
⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯ Unhandled Error ⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯
TypeError: The "path" argument must be of type string. Received an instance of FileHandle
❯ new NodeError node:internal/errors:372:5
❯ validateString node:internal/validators:120:11
❯ Object.isAbsolute node:path:1157:5
❯ VirtualFS.mapToBase .pnp.cjs:10557:24
❯ VirtualFS.fsMapToBase .pnp.cjs:10475:19
❯ VirtualFS.writeFilePromise .pnp.cjs:10379:46
❯ PosixFS.writeFilePromise .pnp.cjs:10379:24
❯ URLFS.writeFilePromise .pnp.cjs:10379:24
❯ IndentedLogger.baseLog .yarn/__virtual__/vitest-virtual-29b0c3d2b0/0/cache/vitest-npm-0.18.1-e5f5447995-0d3a77625e.zip/node_modules/vitest/dist/chunk-vite-node-externalize.6956d2d9.mjs:8023:53
❯ IndentedLogger.log .yarn/__virtual__/vitest-virtual-29b0c3d2b0/0/cache/vitest-npm-0.18.1-e5f5447995-0d3a77625e.zip/node_modules/vitest/dist/chunk-vite-node-externalize.6956d2d9.mjs:7910:17
⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯
Serialized Error: {
"code": "ERR_INVALID_ARG_TYPE",
}
All others reporters run fine, including the json
reporter.
Reproduction
Project with Yarn3 PnP config
System Info
System:
OS: Linux 5.13 Ubuntu 20.04.4 LTS (Focal Fossa)
CPU: (16) x64 Intel(R) Core(TM) i9-9900K CPU @ 3.60GHz
Memory: 52.96 GB / 62.72 GB
Container: Yes
Shell: 5.0.17 - /bin/bash
Binaries:
Node: 16.16.0 - /usr/bin/node
Yarn: 3.2.1 - /usr/bin/yarn
npm: 8.11.0 - /usr/bin/npm
Browsers:
Chrome: 103.0.5060.114
Firefox: 102.0
Used Package Manager
yarn
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.
Please, provide sufficient reproduction.
There it is
Sorry, I don't see any errors with this reproduction. JUnit works fine.
I had this issue appear when upgrading from v0.29.2 to v0.29.7. After which all versions from v0.29.2 going forward gave me this error. I tried clearing out node_modules
, which did not resolve the issue.
This happened for me when using the default reporters. When I switch to ['html', 'text']
I no longer get the path issue, but now my tests don't contribute to coverage at all. I'll make a separate issue for that problem.