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

chore: Check project dependencies for CT compatibility #26497

Merged
merged 2 commits into from
Apr 17, 2023

Conversation

mike-plummer
Copy link
Contributor

@mike-plummer mike-plummer commented Apr 13, 2023

  • Closes cypress-io/cypress-internal#568

Related to cypress-io/cypress-services#5578

Additional details

Check project dependencies to detect potential compatibility for component testing to help identify & assist projects that are using e2e tests that could benefit from using CT instead or in addition

Steps to test

  1. For all commands, run with DEBUG=cypress:data-context:sources:VersionsDataSource
  2. Open a project with no dependencies, verify no x-dependencies header is included in logging
  3. Open a project with non-CT dependencies (eg cypress, lodash, etc), verify no x-dependencies header is included in logging
  4. Open a project with at least one CT dependency (eg, vite, react, svelte), verify all matching CT dependencies are included in the x-dependencies header in the format {package}@{majorVersion},.... (react@18,react-dom@18,vite@4)

How has the user experience changed?

No user-facing change

PR Tasks

@mike-plummer mike-plummer marked this pull request as ready for review April 14, 2023 17:36
@cypress
Copy link

cypress bot commented Apr 14, 2023

34 flaky tests on run #45550 ↗︎

0 27260 1307 0 Flakiness 34

Details:

Cleanup
Project: cypress Commit: d12109c7e1
Status: Passed Duration: 18:03 💡
Started: Apr 14, 2023 5:46 PM Ended: Apr 14, 2023 6:04 PM
Flakiness  commands/net_stubbing.cy.ts • 1 flaky test • 5x-driver-firefox

View Output Video

Test Artifacts
network stubbing > intercepting request > can delay and throttle a StaticResponse Output
Flakiness  e2e/origin/commands/navigation.cy.ts • 1 flaky test • 5x-driver-firefox

View Output Video

Test Artifacts
cy.origin navigation > #consoleProps > .go() Output
Flakiness  commands/waiting.cy.js • 1 flaky test • 5x-driver-firefox

View Output Video

Test Artifacts
... > errors > throws when waiting for 2nd response to route Output
Flakiness  e2e/origin/config_env.cy.ts • 1 flaky test • 5x-driver-firefox

View Output Video

Test Artifacts
cy.origin- Cypress.config() > serializable > overwrites different values in secondary, even if the Cypress.config() value does not exist in the primary Output
Flakiness  e2e/origin/commands/assertions.cy.ts • 1 flaky test • 5x-driver-firefox

View Output Video

Test Artifacts
cy.origin assertions > #consoleProps > .should() and .and() Output

The first 5 flaky specs are shown, see all 23 specs in Cypress Cloud.

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

@mike-plummer
Copy link
Contributor Author

Originally planned to move the dependency check logic into a new source within DataContext so it could be shared in a more centralized way, but that change ballooned pretty significantly and ended up having knock-on effects into our public API for the third-party framework stuff

@astone123
Copy link
Contributor

astone123 commented Apr 14, 2023

@mike-plummer how is this supposed to behave in global mode? This request only goes out right when launchpad is opened, at which point no project is selected. Are we cool with this just not collecting project dependencies when the project is opened with global mode?

Edit: just realized that it looks like this request gets fired again after I select a project, nevermind

Copy link
Contributor

@astone123 astone123 left a comment

Choose a reason for hiding this comment

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

Tested this out locally - it worked as expected for me 👍🏻 code looks good

Copy link
Contributor

@lmiller1990 lmiller1990 left a comment

Choose a reason for hiding this comment

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

Great, looks good!


debug('Checking %d dependencies in project', dependenciesToCheck.length)
// Check all dependencies of interest in parallel
const dependencyResults = await Promise.allSettled(
Copy link
Contributor

Choose a reason for hiding this comment

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

Hardly see allSettled, nice! I think we could have got away with Promise.all and return undefined with a filter instead of throwing an error and using fulfilled, but fine with this, too.

@@ -18,4 +19,8 @@ export class UtilDataSource {
// which is what will be used here
return fetch(input, { agent, ...init })
}

isDependencyInstalled (dependency: Cypress.CypressComponentDependency, projectPath: string) {
return isDependencyInstalled(dependency, projectPath)
Copy link
Contributor

Choose a reason for hiding this comment

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

Nice to see we could leverage isDependencyInstalled making this PR pretty straight forward 👍

@lmiller1990 lmiller1990 merged commit 6209b91 into develop Apr 17, 2023
4 checks passed
@lmiller1990 lmiller1990 deleted the mikep/568-check-project-deps branch April 17, 2023 08:05
astone123 pushed a commit to kgroat/cypress that referenced this pull request Apr 19, 2023
)

* chore: Check project dependencies for CT compatibility

* Cleanup
tgriesser added a commit that referenced this pull request Apr 25, 2023
* feat/protocol: (45 commits)
  chore: adding support for url:changed (#26519)
  chore: adding viewport:changed to protocol (#26508)
  chore: Reduce dependencies and binary size, add circle ci detector (#26522)
  chore: 12.10.0 release (#26517)
  test: fix flaky tests (#26505)
  chore: Check project dependencies for CT compatibility (#26497)
  chore: update vm2 to 3.9.16 (#26489)
  chore: enable builds on feat/protocol branch (#26506)
  chore: [skip ci] update to labels looked at by stalebot (#26496)
  chore: connecting to electron browser (#26471)
  chore: [skip ci] turning on stale bot (#26488)
  chore: fix issue with logs without wallClockUpdatedAt (#26473)
  Update triage_add_to_project.yml
  chore: Update Chrome (stable) to 112.0.5615.49 and Chrome (beta) to 113.0.5672.24 (#26434)
  feat: display framework definition errors (#26183)
  fix: correctly resolve dependencies for CT onboarding when using Yarn Plug n Play (#26452)
  fix: Subscribe to framework detection changes in wizard (#26437)
  fix: make clicks on type('{enter}') composed (#26395)
  chore: update add-to-project workflow (#26439)
  chore: Pass telemetry resources from the node process to the browser (#26468)
  ...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants