Skip to content

[Bug] Error with vue3 + vue-cli-plugin-mocha + Yarn Berry (V3) + PNP #129

Open
@tragid

Description

Reproduction link

github.com

Environment info

  System:
    OS: macOS 12.3.1
    CPU: (8) x64 Intel(R) Core(TM) i7-8557U CPU @ 1.70GHz
  Binaries:
    Node: 12.22.5 - ~/.nvm/versions/node/v12.22.5/bin/node
    Yarn: 3.2.0 - ~/.nvm/versions/node/v12.22.5/bin/yarn
    npm: 6.14.14 - ~/.nvm/versions/node/v12.22.5/bin/npm
  Browsers:
    Chrome: 100.0.4896.75
    Edge: Not Found
    Firefox: 98.0.2
    Safari: 15.4
  npmGlobalPackages:
    @vue/cli: Not Found

Steps to reproduce

  1. Clone project with vue3 and yarn berry. Example https://github.com/tragid/yarn-vue-mocha-bug
  2. run yarn install
  3. run yarn test:unit

What is expected?

Tests executed successfully.

What is actually happening?

Unit tests fail with errors:

RUNTIME EXCEPTION  Exception occurred while loading your tests

Error: Qualified path resolution failed: we looked for the following paths, but none could be accessed.

Source path: {PATH_TO_PROJECT}/yarn-vue-mocha-bug/dist/js/main.js
Not found: {PATH_TO_PROJECT}/yarn-vue-mocha-bug/dist/js/main.js
Not found: {PATH_TO_PROJECT}/yarn-vue-mocha-bug/dist/js/main.js.js
Not found: {PATH_TO_PROJECT}/yarn-vue-mocha-bug/dist/js/main.js.json
Not found: {PATH_TO_PROJECT}/yarn-vue-mocha-bug/dist/js/main.js.node

Require stack:
- {PATH_TO_PROJECT}/yarn-vue-mocha-bug/.yarn/cache/mocha-npm-8.4.0-a999d05791-4bcf006705.zip/node_modules/mocha/lib/mocha.js
- {PATH_TO_PROJECT}/yarn-vue-mocha-bug/.yarn/cache/mocha-npm-8.4.0-a999d05791-4bcf006705.zip/node_modules/mocha/index.js
- {PATH_TO_PROJECT}/yarn-vue-mocha-bug/.yarn/__virtual__/mochapack-virtual-ca470f35e0/0/cache/mochapack-npm-2.1.4-3d5d55697e-ede95202be.zip/node_modules/mochapack/lib/cli/argsParser/parseArgv/mocha/parseMochaArgs.js
- {PATH_TO_PROJECT}/yarn-vue-mocha-bug/.yarn/__virtual__/mochapack-virtual-ca470f35e0/0/cache/mochapack-npm-2.1.4-3d5d55697e-ede95202be.zip/node_modules/mochapack/lib/cli/argsParser/parseArgv/index.js
- {PATH_TO_PROJECT}/yarn-vue-mocha-bug/.yarn/__virtual__/mochapack-virtual-ca470f35e0/0/cache/mochapack-npm-2.1.4-3d5d55697e-ede95202be.zip/node_modules/mochapack/lib/cli/index.js
- {PATH_TO_PROJECT}/yarn-vue-mocha-bug/.yarn/__virtual__/mochapack-virtual-ca470f35e0/0/cache/mochapack-npm-2.1.4-3d5d55697e-ede95202be.zip/node_modules/mochapack/bin/mochapack
   at Function.require$$0.Module._resolveFilename ({PATH_TO_PROJECT}/yarn-vue-mocha-bug/.pnp.cjs:22225:13)
   at Function._resolveFilename ({PATH_TO_PROJECT}/yarn-vue-mocha-bug/.yarn/__virtual__/mochapack-virtual-ca470f35e0/0/cache/mochapack-npm-2.1.4-3d5d55697e-ede95202be.zip/node_modules/mochapack/src/util/registerRequireHook.ts:21:34)
   at Function.require$$0.Module._load ({PATH_TO_PROJECT}/yarn-vue-mocha-bug/.pnp.cjs:22079:42)
   at Module.require (internal/modules/cjs/loader.js:887:19)
   at require (internal/modules/cjs/helpers.js:74:18)
   at {PATH_TO_PROJECT}/yarn-vue-mocha-bug/.yarn/cache/mocha-npm-8.4.0-a999d05791-4bcf006705.zip/node_modules/mocha/lib/mocha.js:436:36
   at Array.forEach (<anonymous>)
   at Mocha.loadFiles ({PATH_TO_PROJECT}/yarn-vue-mocha-bug/.yarn/cache/mocha-npm-8.4.0-a999d05791-4bcf006705.zip/node_modules/mocha/lib/mocha.js:433:14)
   at Mocha.run ({PATH_TO_PROJECT}/yarn-vue-mocha-bug/.yarn/cache/mocha-npm-8.4.0-a999d05791-4bcf006705.zip/node_modules/mocha/lib/mocha.js:1012:10)
   at {PATH_TO_PROJECT}/yarn-vue-mocha-bug/.yarn/__virtual__/mochapack-virtual-ca470f35e0/0/cache/mochapack-npm-2.1.4-3d5d55697e-ede95202be.zip/node_modules/mochapack/src/runner/TestRunner.ts:128:23

 [=========================] 100% (completed)

ERROR  Error: mochapack exited with code 1.
Error: mochapack exited with code 1.
   at ChildProcess.<anonymous> ({PATH_TO_PROJECT}/yarn-vue-mocha-bug/.yarn/__virtual__/@vue-cli-plugin-unit-mocha-virtual-deed287469/0/cache/@vue-cli-plugin-unit-mocha-npm-5.0.1-3d48668535-768aa72c2e.zip/node_modules/@vue/cli-plugin-unit-mocha/index.js:86:18)
   at ChildProcess.emit (events.js:326:22)
   at Process.ChildProcess._handle.onexit (internal/child_process.js:276:12)

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions