Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[0.20.x] vitest no longer works with yarn pnp #1758

Closed
6 tasks done
jereklas opened this issue Jul 31, 2022 · 5 comments
Closed
6 tasks done

[0.20.x] vitest no longer works with yarn pnp #1758

jereklas opened this issue Jul 31, 2022 · 5 comments
Labels

Comments

@jereklas
Copy link
Contributor

Describe the bug

After upgrading to 0.20.x, tests are no longer able to run due to yarn being unable to find a module

events.js:377
      throw er; // Unhandled 'error' event
      ^
Error [ERR_MODULE_NOT_FOUND]: Cannot find module '/home/user/git/vitest_yarn2/.yarn/__virtual__/vitest-virtual-3235595f85/0/cache/vitest-npm-0.20.2-9730ec2bf1-eea156689f.zip/node_modules/vitest/dist/loader.mjs' imported from /home/user/git/vitest_yarn2/
Did you mean to import /home/user/git/vitest_yarn2/.yarn/__virtual__/vitest-virtual-3235595f85/0/cache/vitest-npm-0.20.2-9730ec2bf1-eea156689f.zip/node_modules/vitest/dist/loader.mjs?

Reproduction

Here is a repo that exhibits the problem. I purposefully left it in a working state with vitest at 0.19.1, to show that 0.19.1 worked. The README.md has details on how to reproduce.

https://github.com/jereklas/vitest_yarn2

System Info

System:
    OS: Linux 5.14 Ubuntu 20.04.4 LTS (Focal Fossa)
    CPU: (8) x64 11th Gen Intel(R) Core(TM) i5-1135G7 @ 2.40GHz
    Memory: 465.59 MB / 15.36 GB
    Container: Yes
    Shell: 5.0.17 - /bin/bash
  Binaries:
    Node: 14.20.0 - /usr/bin/node
    Yarn: 3.2.2 - /usr/bin/yarn
    npm: 6.14.17 - /usr/bin/npm
  Browsers:
    Chrome: 103.0.5060.114
    Firefox: 102.0

Used Package Manager

yarn

Validations

@sheremet-va
Copy link
Member

Try disabling deps.registerNodeLoader for now

@jereklas
Copy link
Contributor Author

I was just doing that and was about to report back that deps.registerNodeLoader is a work around! You beat me to it.

@sheremet-va
Copy link
Member

It's not possible to use custom experimental loader with Yarn PnP at the moment. We need nodejs/node#43772 to be resolved first.

For now we will detect, if running under Yarn PnP and disable registerNodeLoader in #1773.

@manoldonev
Copy link

Experienced similar issue in a SolidJS project maintained with pnpm. Tests worked flawlessly with 0.19.x and started failing with a cryptic You appear to have multiple instances of Solid. This can lead to unexpected behavior. in 0.20.x. Workaround to disable deps.registerNodeLoader also works in this scenario.

@sheremet-va
Copy link
Member

sheremet-va commented Aug 3, 2022

Experienced similar issue in a SolidJS project maintained with pnpm. Tests worked flawlessly with 0.19.x and started failing with a cryptic You appear to have multiple instances of Solid. This can lead to unexpected behavior. in 0.20.x. Workaround to disable deps.registerNodeLoader also works in this scenario.

@manoldonev Solid example was updated, you no longer need to inline solid. You can join discord to see updates.

@github-actions github-actions bot locked and limited conversation to collaborators Jun 15, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

3 participants