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

fix: do not cache module resolution during launchpad dependency detection #26726

Merged
merged 7 commits into from
May 12, 2023

Conversation

lmiller1990
Copy link
Contributor

Additional details

We were caching the module resolution during the deps detection step, so even after installing a dep, we don't detect it - classic caching issue 🤦

Only an issue if a user is missing dependencies, which shouldn't be too common.

Steps to test

Repro in the original issue. I made a React/Vite project, removed react-dom, then proceeded to setup Cypress CT. react-dom was not detected. I did yarn add react-dom in the project, and now it is correctly detected.

How has the user experience changed?

Correctly detects newly added dependencies during onboarding and shows user.

PR Tasks

@@ -43,7 +43,7 @@ export async function isDependencyInstalled (dependency: Cypress.CypressComponen
// for module resolution.
const resolvePackagePath = require('resolve-package-path')

const packageFilePath = resolvePackagePath(dependency.package, projectPath)
const packageFilePath = resolvePackagePath(dependency.package, projectPath, false)
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is the fix, the third arg is whether to cache or not - we don't want caching, or it won't find the dependency, even if the user adds it.

@@ -8,8 +8,7 @@
"preview": "vite preview"
},
"dependencies": {
"react": "^18.0.0",
"react-dom": "^18.0.0"
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Intentionally removed to reproduce issue in End to End test.

@lmiller1990 lmiller1990 requested a review from a team May 11, 2023 01:14
@cypress
Copy link

cypress bot commented May 11, 2023

Passing run #46257 ↗︎

0 104 0 0 Flakiness 0

Details:

Merge branch 'develop' into lmiller/issue-26685
Project: cypress Commit: 7370fd7bf8
Status: Passed Duration: 17:18 💡
Started: May 12, 2023 4:19 PM Ended: May 12, 2023 4:37 PM

This comment has been generated by cypress-bot as a result of this project's GitHub integration settings.

Copy link
Contributor

@mike-plummer mike-plummer left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, just a couple minor suggestions - will approve assuming those are addressed one way or the other

cli/CHANGELOG.md Outdated Show resolved Hide resolved
@mike-plummer mike-plummer requested a review from a team May 11, 2023 13:09
cli/CHANGELOG.md Outdated Show resolved Hide resolved
@mike-plummer mike-plummer requested a review from a team May 11, 2023 14:14
Copy link
Contributor

@warrensplayer warrensplayer left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@mike-plummer mike-plummer merged commit 4f4a3c8 into develop May 12, 2023
@mike-plummer mike-plummer deleted the lmiller/issue-26685 branch May 12, 2023 19:39
@cypress-bot
Copy link
Contributor

cypress-bot bot commented May 23, 2023

Released in 12.13.0.

This comment thread has been locked. If you are still experiencing this issue after upgrading to
Cypress v12.13.0, please open a new issue.

@cypress-bot cypress-bot bot locked as resolved and limited conversation to collaborators May 23, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

CT onboarding hangs waiting for dependency installation
3 participants