vitest icon indicating copy to clipboard operation
vitest copied to clipboard

[TypeError] junit reporter with yarn3 PnP fails

Open mister-good-deal opened this issue 2 years ago • 3 comments

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

mister-good-deal avatar Jul 18 '22 16:07 mister-good-deal

Please, provide sufficient reproduction.

sheremet-va avatar Jul 18 '22 16:07 sheremet-va

There it is

mister-good-deal avatar Jul 20 '22 14:07 mister-good-deal

Sorry, I don't see any errors with this reproduction. JUnit works fine.

sheremet-va avatar Aug 02 '22 08:08 sheremet-va

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.

tortilaman avatar Mar 20 '23 21:03 tortilaman