Skip to content

Conversation

@lmiller1990
Copy link
Contributor

@lmiller1990 lmiller1990 commented Jul 28, 2022

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.

image

PR Tasks

  • Have tests been added/updated?
  • Has the original issue (or this PR, if no issue exists) been tagged with a release in ZenHub? (user-facing changes only)
  • Has a PR for user-facing changes been opened in cypress-documentation?
  • Have API changes been updated in the type definitions?

@cypress-bot
Copy link
Contributor

cypress-bot bot commented Jul 28, 2022

Thanks for taking the time to open a PR!

@lmiller1990 lmiller1990 changed the title wip: basic implementation feat: warn when detecting unsupported dependencies for component testing Jul 28, 2022
@lmiller1990 lmiller1990 marked this pull request as ready for review July 28, 2022 07:45
@lmiller1990 lmiller1990 requested review from a team as code owners July 28, 2022 07:45
@lmiller1990 lmiller1990 requested review from nagash77 and removed request for a team and nagash77 July 28, 2022 07:45
@cypress
Copy link

cypress bot commented Jul 28, 2022



Test summary

9380 0 118 0Flakiness 0


Run details

Project cypress
Status Passed
Commit d17479b
Started Aug 1, 2022 12:57 AM
Ended Aug 1, 2022 1:12 AM
Duration 15:34 💡
OS Linux Debian - 11.3
Browser Multiple

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

@cbfrance
Copy link

cbfrance commented Jul 28, 2022

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
replace Cypress may not function as expected) — If you're experiencing problems, downgrade dependencies and restart Cypress.

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)
Copy link
Contributor

@ZachJW34 ZachJW34 Jul 28, 2022

Choose a reason for hiding this comment

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

Suggested change
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.

Copy link
Contributor Author

@lmiller1990 lmiller1990 Jul 29, 2022

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?

Copy link
Contributor Author

@lmiller1990 lmiller1990 Jul 29, 2022

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 have vueclivue2 and 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 {
Copy link
Contributor

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?

Copy link
Contributor Author

@lmiller1990 lmiller1990 Jul 29, 2022

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:
image

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.

@lmiller1990
Copy link
Contributor Author

@ZachJW34 @christopherfrance I updated the warning message and styling.

image

image

@lmiller1990 lmiller1990 requested a review from ZachJW34 July 29, 2022 06:50
@lmiller1990
Copy link
Contributor Author

@ZachJW34 updated the logic to handle the case you pointed out and added tests around it, good catch.

@rockindahizzy rockindahizzy self-requested a review July 29, 2022 14:11
Copy link
Contributor

@ZachJW34 ZachJW34 left a 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

Copy link
Contributor

@rockindahizzy rockindahizzy left a comment

Choose a reason for hiding this comment

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

LGTM!

@lmiller1990 lmiller1990 merged commit cbb5e35 into develop Aug 1, 2022
@lmiller1990 lmiller1990 deleted the lmiller/add-runtime-check-for-ct-deps branch August 1, 2022 01:40
@cypress-bot
Copy link
Contributor

cypress-bot bot commented Aug 2, 2022

Released in 10.4.0.

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

@cypress-bot cypress-bot bot locked as resolved and limited conversation to collaborators Aug 2, 2022
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.

Add runtime semver checks ensuring the version of vite / other external dependencies

5 participants