cypress icon indicating copy to clipboard operation
cypress copied to clipboard

fix: resolve reporters using module resolution algorithm (#4536)

Open steinybot opened this issue 2 years ago • 4 comments

  • Closes #4536

Additional details

  • The explicit join to the project root meant that it effectively disabled the normal module resolution algorithm which would just work™️.
  • This has been there since at least https://github.com/cypress-io/cypress/commit/98c4538ddda568a294f665600ff527a0db86b3ab.
  • I kept the project root there as the starting point as I wasn't sure whether __dirname or the current working directory would be correct.
  • https://nodejs.org/dist/latest-v18.x/docs/api/modules.html#requireresolverequest-options
  • I'd like some help writing a test. What is the best way?
  • Also might need to update the error. It has the correct path but it doesn't explain that it uses the module resolution algorithm.

Steps to test

  1. Setup a small monorepo that uses workspaces.
  2. Add cypress to the workspace project.
  3. Add a reporter to the root.
  4. Run cypress in the workspace project.
  5. It should find the reporter.

How has the user experience changed?

The behaviour should be the same except that it now searches up properly. It will also look in the global modules.

PR Tasks

steinybot avatar Dec 19 '23 09:12 steinybot

cypress-app-bot avatar Dec 19 '23 09:12 cypress-app-bot

CLA assistant check
All committers have signed the CLA.

CLAassistant avatar Dec 19 '23 09:12 CLAassistant

@steinybot Thanks for the contribution! Could you please sign our CLA?

jennifer-shehane avatar Dec 19 '23 14:12 jennifer-shehane

@steinybot is this still in draft or is this ready to review?

jordanpowell88 avatar Dec 21 '23 21:12 jordanpowell88

I need some help figuring out how to write a test for it. Other than that it is ready for review.

steinybot avatar Jan 10 '24 20:01 steinybot

This PR has not had any activity in 180 days. If no activity is detected in the next 14 days, this PR will be closed.

cypress-app-bot avatar Jul 09 '24 01:07 cypress-app-bot

This PR has been closed due to inactivity

cypress-app-bot avatar Jul 23 '24 01:07 cypress-app-bot