question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Cypress and Yarn 2 PNP support

See original GitHub issue

Current behavior:

In Yarn 2 monorepo I have a package a and tests in package b.

When I do

// b/cypress/plugins/index
module.exports = require('a/src/cypress/plugins');

It works as expected.

But

// a/cypress/commands/index
require('a/src/cypress/commands');

Fails with error:

Oops...we found an error preparing this test file:

  /Users/xxx/b/cypress/support/index.js

The error was:

Error: Cannot find module 'a/src/cypress/support' from '/Users/xxx/b/cypress/support'

Looks like Yarn’s Plug’n’play file .pnp.js is not present in second (commands) context.

Desired behavior:

Require of monorepo packages should work.

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Reactions:18
  • Comments:29 (8 by maintainers)

github_iconTop GitHub Comments

16reactions
masihjahangiricommented, Nov 21, 2020

Cypress should support built-in yarn 2 (PNP algorithm) and it’s really important. We use yarn 2 for the zero-install feature to improve our CI build time, and If we use nodeLinker, we miss that feature.

15reactions
benwainwrightcommented, Dec 11, 2020

+1 for this please. I’m currently completely unable to write my integration tests or any code related to it in TypeScript in my otherwise entirely TypeScript based yarn2/pnp project.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Resolving Yarn2 + Cypress GitHub Action: Cannot find ...
I contributed a request to the original issue to support Yarn's .pnp.cjs file, which should patch require.resolve to find modules installed using Plug...
Read more >
How can Webpack 5 polyfills resolve with Yarn 2 PnP? ...
Turns out that the path polyfill for Webpack 5 is working fine with Yarn 2. The issue is that the package itself, cypress-dark, ......
Read more >
cypress | Yarn - Package Manager
Fast, easy and reliable testing for anything that runs in a browser. What is this? Cypress comes packaged as an npm module, which...
Read more >
Changelog
This will make the run faster and help mitigate #21743. Fixes #24919. 12.0.2. Released 12/08/2022. Bugfixes: Fixed a regression in ...
Read more >
Hello Yarn 2, Goodbye Node_modules. | by Friedrich Politz
Plug'n'Play support isn't the only big change coming with Yarn 2 (the concept in ... Yarn now holds a map inside a single...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found