Skip to content

Conversation

@elevatebart
Copy link
Contributor

@elevatebart elevatebart commented Mar 24, 2022

User facing changelog

Allow migrating a project that uses config.env by adding a default env property to the config object.

Details

In some pre-10.X plugins, the config object is modified to add variables to config.env. In the migration process, we run the pluginsFile function. During this execution, plugins expect the config object contain certain values like "env" since they are provided as default values in 9.X.

EDIT 1: I do not think it is a good idea to copy all the default values from 9 into the migration process. This would mean a lot of code to maintain. I preferred a more pragmatic approach: Check that most common plugins work and fix only the values that are actually used in those.

EDIT 2: Since I had to diff the output anyway, I finally opted for copying the full defaults from 9.X. I don't expect them to change much and it will be helpful for users. Migration now mirrors as well as possible the way the config is resolved in 9.X.

  • 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?
  • Have new configuration options been added to the cypress.schema.json?

@cypress-bot
Copy link
Contributor

cypress-bot bot commented Mar 24, 2022

Thanks for taking the time to open a PR!

@cypress
Copy link

cypress bot commented Mar 24, 2022



Test summary

17792 0 217 0Flakiness 2


Run details

Project cypress
Status Passed
Commit af8d41e
Started Apr 1, 2022 4:44 AM
Ended Apr 1, 2022 4:56 AM
Duration 11:44 💡
OS Linux Debian - 10.10
Browser Multiple

View run in Cypress Dashboard ➡️


Flakiness

commands/xhr.cy.js Flakiness
1 ... > no status when request isnt forced 404
cypress/proxy-logging.cy.ts Flakiness
1 Proxy Logging > request logging > xhr log has response body/status code when xhr response is logged second

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

@elevatebart elevatebart marked this pull request as ready for review March 25, 2022 01:48
@elevatebart elevatebart requested review from a team as code owners March 25, 2022 01:48
@elevatebart elevatebart requested review from jennifer-shehane and lmiller1990 and removed request for a team March 25, 2022 01:48
@lmiller1990 lmiller1990 changed the title fix: allow migration of code-coverage plugin fix: allow migration of pluginsFile using env properties Mar 28, 2022
@lmiller1990 lmiller1990 removed request for a team and jennifer-shehane March 28, 2022 01:51
lmiller1990
lmiller1990 previously approved these changes Mar 28, 2022
@BlueWinds
Copy link
Contributor

@elevatebart - Can you add details about what this is fixing and why to the PR description?

config.integrationFolder = 'tests/e2e'
config.testFiles = '**/*.spec.js'
// In the plugin @cypress/code-coverage this pattern is used
config.env.CYPRESS_RECORD_KEY_DRAGGING = 'true'
Copy link
Contributor

Choose a reason for hiding this comment

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

So as I understand it, this PR makes it so that this line no longer causes an error. Does it cause any change in the output post-migration that we can assert on (that it's persisted)?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It does not.
I will indeed add a more detailed description of the changes.

BlueWinds
BlueWinds previously approved these changes Mar 30, 2022
@lmiller1990
Copy link
Contributor

@elevatebart looks good - can you get CI green so we can merge? Anything left?

@elevatebart elevatebart dismissed stale reviews from BlueWinds and lmiller1990 via b444c8e March 31, 2022 01:33
@elevatebart elevatebart marked this pull request as draft March 31, 2022 14:21
@elevatebart elevatebart marked this pull request as ready for review March 31, 2022 15:14
@elevatebart
Copy link
Contributor Author

@lmiller1990 The PR seems ready for review.

I will wait until CI is greeen to send you any slack message and re-request your review.

@elevatebart elevatebart requested a review from lmiller1990 March 31, 2022 21:48
@lmiller1990
Copy link
Contributor

lmiller1990 commented Apr 1, 2022

✅ - let's get one more review.

//
// Add options in alphabetical order for better readability

// TODO - add boolean attribute to indicate read-only / static vs mutable options
Copy link
Collaborator

Choose a reason for hiding this comment

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

Do we have a followup ticket for this?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

no we don't. this file is a pure copy paste of the 9.X config/lib/options.ts. I should clean it up and remove all the not so useful fluff from it.

I could also add where it comes from at the top of the file with a warning to use it only to migrate 9.X projects.

@lmiller1990
Copy link
Contributor

Looks good @elevatebart, once we have an answer on the question above let's merge!!

@lmiller1990 lmiller1990 merged commit 771f765 into 10.0-release Apr 1, 2022
@lmiller1990 lmiller1990 deleted the elevatebart/fix/code-coverage-migration branch April 1, 2022 08:42
tgriesser added a commit that referenced this pull request Apr 1, 2022
* 10.0-release:
  fix: add index.mjs to the published files of cli (#20884)
  refactor: lift indexHtmlFile up to component, add validation (#20870)
  fix: allow migration of pluginsFile using `env` properties (#20770)
  fix: viewport from CLI on CT (#20849)
  fix: git data source unit test failure (#20875)
  fix: Ensuring current browser is synchronized between app and launchpad (#20830)
  Fix missed await on merge conflict resolution
  test(unification): move record keys to contexts (#20860)
  test: move record keys to contexts (#20859)
  make alerts more responsive
  chore: Update Chrome (stable) to 100.0.4896.60 (#20841)
  Revise test.
  fix: cy.root respect timeout option.
  fix(deps): update dependency ansi-regex to v4.1.1 [security] (#20836)
  chore(deps): update dependency ansi-regex to 4.1.1 [security] (#20807)
  chore: Refactor cri-client to use async/await (#20825)
  remove automationId from runnerStore
  fix firefox automation and adress feedback
  feat: add automation warning/disconnected states in app
tgriesser added a commit that referenced this pull request Apr 1, 2022
…ess into tgriesser/fix/UNIFY-1389

* 'tgriesser/fix/UNIFY-1389' of github.com:cypress-io/cypress: (56 commits)
  fix: add index.mjs to the published files of cli (#20884)
  refactor: lift indexHtmlFile up to component, add validation (#20870)
  fix: allow migration of pluginsFile using `env` properties (#20770)
  fix: viewport from CLI on CT (#20849)
  Don't communicate if process isn't connected
  Remove config.get
  Update packages/data-context/src/data/ProjectLifecycleManager.ts
  fix: git data source unit test failure (#20875)
  add comment for autoBindDebug
  PR comments
  Fix tests that visit app without a configured testing type
  Fix type script
  Fix issue with refreshing on the welcome screen
  Add test for migration scenario
  Fix types
  Move IPC logic to all be in ProjectConfigIPC
  Other minor cleanup
  Additional code cleanup
  Fix more tests
  Fix typo
  ...
tgriesser added a commit that referenced this pull request Apr 5, 2022
* 10.0-release: (92 commits)
  chore: remove dependency-tree dep (#20905)
  chore(launchpad): work on infra for scaffold tests (#20818)
  fix: build mjs in the cli (#20889)
  fix(unify): Cypress version link should point to Cypress doc's changelog (#20869)
  fix: windows build (#20854)
  fix: add index.mjs to the published files of cli (#20884)
  refactor: lift indexHtmlFile up to component, add validation (#20870)
  fix: allow migration of pluginsFile using `env` properties (#20770)
  fix: viewport from CLI on CT (#20849)
  Don't communicate if process isn't connected
  Remove config.get
  Update packages/data-context/src/data/ProjectLifecycleManager.ts
  fix: git data source unit test failure (#20875)
  add comment for autoBindDebug
  fix: Ensuring current browser is synchronized between app and launchpad (#20830)
  Fix missed await on merge conflict resolution
  test(unification): move record keys to contexts (#20860)
  test: move record keys to contexts (#20859)
  PR comments
  Fix tests that visit app without a configured testing type
  ...
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.

5 participants