-
Notifications
You must be signed in to change notification settings - Fork 3.4k
feat: warn when detecting unsupported dependencies for component testing #22964
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
Conversation
|
Thanks for taking the time to open a PR!
|
Test summaryRun details
View run in Cypress Dashboard ➡️ This comment has been generated by cypress-bot as a result of this project's GitHub integration settings. You can manage this integration in this project's settings in the Cypress Dashboard |
|
Thanks @lmiller1990 this looks like a good improvement from design perspective. There are two changes being discussed in this thread: DONE: Remove Restart button since it seems unlikely to work as expected. TODO: The last line could more actionable / explain what to do next. Here is our suggestion (to |
| const devServerOptions = this._cachedLoadConfig.initialConfig.component.devServer | ||
|
|
||
| const bundler = WIZARD_BUNDLERS.find((x) => x.type === devServerOptions.bundler) | ||
| const framework = WIZARD_FRAMEWORKS.find((x) => x.type === devServerOptions.framework) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| const framework = WIZARD_FRAMEWORKS.find((x) => x.type === devServerOptions.framework) | |
| const framework = WIZARD_FRAMEWORKS.find((x) => x.configFramework === devServerOptions.framework) |
The framework.type doesn't match to the devServer.framework.
Making this change creates an issue though. With the current code, there is no way to distinguish between a vueclivue2 app and a vueclivue3 app. The frameworks.find will find the first framework framework matching the configFramework. In the case of loading a vueclivue3 app, you'll get a warning stating that the vue version is out of date which is incorrect.
Not sure the best way to solve this. You would have to have additional logic to narrow down frameworks that have a matching configFramework (which in this case is only vue-cli), but this isn't deterministic since the deps we are trying to verify can be greater or smaller.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmmm you are right - I wonder why TS isn't erroring, I guess because some of them happen to match up?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok, so the solution would likely be:
- grab all frameworks that match
vue-cli(so we havevueclivue2and vueclivue3`) - check each one, see if deps match
- if they do we are golden
- if none of them match, error out
The challenge is how we get a nice warning message... there isn't a super clean way to know if they want vueclivue2 or vueclivue3. We could have some logic to intelligently infer this, or just make a more generic warning. I'll see what I can come up with.
| </script> | ||
|
|
||
| <style lang="scss"> | ||
| .warning-markdown { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Any reason to not use tailwind?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done - I still need to do .warning-markdown > ul since you cannot nest selectors using Tailwind, but I changed it to use @apply.
The reason I did it like this is we need to style the <ul> which is part of the generated HTML in the errors package. I tried adding it with the rest of the styles but it's getting clobbered by something else and the styles aren't applied:

Updated the code leaving a comment - not sure if this ever will be addressed, but at least it'll point people to the right place if they want to expand on the styling.
|
@ZachJW34 @christopherfrance I updated the warning message and styling. |
|
@ZachJW34 updated the logic to handle the case you pointed out and added tests around it, good catch. |
ZachJW34
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
My comments are addressed! Tested it out and works great. One small question
rockindahizzy
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
|
Released in This comment thread has been locked. If you are still experiencing this issue after upgrading to |


User facing changelog
N/A
Additional details
Add some runtime checks for CT deps, like
vite,react, etc. We do these during setup. Now, we also do it each launch. This will help warn users if they've updated a dependency (like Vite) to a new version we haven't yet got official support for.Steps to test
You will need a project with some mismatched dependencies. This PR includes one called
component-testing-outdated-dependencies, you could test with that, if you want. Run yarn install inside it, fire up Cypress and choose that project. You should see the appropriate warnings.How has the user experience changed?
Launchpad now shows a warning with the mismatched dependencies, what you should have provided, and what you did provide. TBA: the exact text, this screenshot is just showing how it looks right now. @christopherfrance will provide the correct text, as discussed here.
PR Tasks
cypress-documentation?type definitions?