-
Notifications
You must be signed in to change notification settings - Fork 3.2k
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: Fix Issue 27103. Retain original array after defaultsDeep #27240
fix: Fix Issue 27103. Retain original array after defaultsDeep #27240
Conversation
|
1 failed and 29 flaky tests on run #48661 ↗︎
Details:
cypress/e2e/e2e/origin/user_agent_override.cy.ts • 1 failed test • 5x-driver-electron
runs.cy.ts • 1 flaky test • app-e2e
specs_list_latest_runs.cy.ts • 1 flaky test • app-e2e
cypress-origin-communicator.cy.ts • 1 flaky test • app-e2e
commands/net_stubbing.cy.ts • 1 flaky test • 5x-driver-firefox
commands/net_stubbing.cy.ts • 1 flaky test • 5x-driver-electron
The first 5 flaky specs are shown, see all 17 specs in Cypress Cloud. This comment has been generated by cypress-bot as a result of this project's GitHub integration settings. |
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.
Great job. I've recommended one refactor, and added a test to ensure this won't regress again. 47c12f1
packages/config/src/project/index.ts
Outdated
for (const key in diffsClone) { | ||
if (Array.isArray(diffsClone[key])) { | ||
merged[key] = _.cloneDeep(diffsClone[key]) | ||
} | ||
} | ||
|
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.
for (const key in diffsClone) { | |
if (Array.isArray(diffsClone[key])) { | |
merged[key] = _.cloneDeep(diffsClone[key]) | |
} | |
} | |
for (const [key, value] of Object.entries(diffsClone)) { | |
if (Array.isArray(value)) { | |
merged[key] = _.cloneDeep(value) | |
} | |
} |
I think this can be a bit more concise. I did not try this, but it should work.
I've also added a test. 47c12f1e4e712f62b0cec582b7dfda98f3177583
You could use this to see if my refactor works. cd packages/app
then yarn dev
. Select the spec (or use it.only
to only run the one test I added).
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.
Hello @lmiller1990. I made the suggested changes and locally tried the original reproduction repo, and it works perfectly fine for it. However, I was not able to run the tests locally. After selecting the spec, I was met with a lot of errors. I modified the it()
block under which you had added the test to it.only()
, however it gave me the following error.
cy.task('__internal_withCtx') timed out after waiting 60000ms.
Because this error occurred during a before each hook we are skipping the remaining tests in the current suite: specChange subscription
Please guide me on how I can actually try and run the tests on my local device?
Let me run CI and see how it goes. |
This seems to massively break things. https://app.circleci.com/pipelines/github/cypress-io/cypress?branch=pull%2F27240 What operating system are you on @NiharPhansalkar? Does Are you able to run other tests - try |
@lmiller1990 Hello, I am running this in a VM running Fedora 38. Yes
|
At least here on GitHub where it shows the checks, it was previously passing most tests, failing about 7. Now all of a sudden it is failing 25 tests. I hope this is only related to the change I made? And has nothing to do with me updating the branch? |
@NiharPhansalkar I think we need a default value: 1deb871 It was trying to do |
@lmiller1990 Hello Lachlan, the |
I'll try and get this one merged up. |
Yes, but say for future contributions for cypress, I may have to test other parts? Where can I actually understand the reason for such issues occurring and try to fix them? |
Right, I understand your question.
I haven't run on Fedora or under a VM before, but the first thing I usually do to debug is run the build with |
Sure! Thank you. |
@lmiller1990 Hello Lachlan. I did run it with
|
Here is the entirely of what I see. I am not sure I can help with running of Fedora specifically; I don't have the time / bandwidth to try Fedora development right now. If you are able to try another distro (eg Ubuntu) where it's known to run, I can possibly help. In the meantime, I'll get this PR ready to go. |
Close in favor of #27312 |
* modifying object after array combination to hold older values * regression test * made suggested changes * config defaults * log * logs * log * log again * update log * changelog * updates changelog * fix typo and move changelog entry and fix link --------- Co-authored-by: Nihar Phansalkar <phansalkarnihar@gmail.com> Co-authored-by: Jennifer Shehane <jennifer@cypress.io> Co-authored-by: Cacie Prins <cacieprins@users.noreply.github.com> Co-authored-by: Cacie Prins <cacie@cypress.io> Co-authored-by: AtofStryker <bglesias@gmail.com>
* modifying object after array combination to hold older values * regression test * made suggested changes * config defaults * log * logs * log * log again * update log * changelog * updates changelog * fix typo and move changelog entry and fix link --------- Co-authored-by: Nihar Phansalkar <phansalkarnihar@gmail.com> Co-authored-by: Jennifer Shehane <jennifer@cypress.io> Co-authored-by: Cacie Prins <cacieprins@users.noreply.github.com> Co-authored-by: Cacie Prins <cacie@cypress.io> Co-authored-by: AtofStryker <bglesias@gmail.com>
* modifying object after array combination to hold older values * regression test * made suggested changes * config defaults * log * logs * log * log again * update log * changelog * updates changelog * fix typo and move changelog entry and fix link --------- Co-authored-by: Nihar Phansalkar <phansalkarnihar@gmail.com> Co-authored-by: Jennifer Shehane <jennifer@cypress.io> Co-authored-by: Cacie Prins <cacieprins@users.noreply.github.com> Co-authored-by: Cacie Prins <cacie@cypress.io> Co-authored-by: AtofStryker <bglesias@gmail.com>
* modifying object after array combination to hold older values * regression test * made suggested changes * config defaults * log * logs * log * log again * update log * changelog * updates changelog * fix typo and move changelog entry and fix link --------- Co-authored-by: Nihar Phansalkar <phansalkarnihar@gmail.com> Co-authored-by: Jennifer Shehane <jennifer@cypress.io> Co-authored-by: Cacie Prins <cacieprins@users.noreply.github.com> Co-authored-by: Cacie Prins <cacie@cypress.io> Co-authored-by: AtofStryker <bglesias@gmail.com>
* modifying object after array combination to hold older values * regression test * made suggested changes * config defaults * log * logs * log * log again * update log * changelog * updates changelog * fix typo and move changelog entry and fix link --------- Co-authored-by: Nihar Phansalkar <phansalkarnihar@gmail.com> Co-authored-by: Jennifer Shehane <jennifer@cypress.io> Co-authored-by: Cacie Prins <cacieprins@users.noreply.github.com> Co-authored-by: Cacie Prins <cacie@cypress.io> Co-authored-by: AtofStryker <bglesias@gmail.com>
* modifying object after array combination to hold older values * regression test * made suggested changes * config defaults * log * logs * log * log again * update log * changelog * updates changelog * fix typo and move changelog entry and fix link --------- Co-authored-by: Nihar Phansalkar <phansalkarnihar@gmail.com> Co-authored-by: Jennifer Shehane <jennifer@cypress.io> Co-authored-by: Cacie Prins <cacieprins@users.noreply.github.com> Co-authored-by: Cacie Prins <cacie@cypress.io> Co-authored-by: AtofStryker <bglesias@gmail.com>
Additional details
What is affected by this change?
Previously the defaultsDeep function was merging/combining arrays. This PR will fix that issue and restore any arrays modified by the
setupNodeEvents
function.Steps to test
To test, copy the cypress.config.js from the
reproduction
section of the issue and configure for e2e testing. Then run cypress usingyarn cypress open --dev --config-file cypress.config.js
. After setting any key within the config object to any array value (within the setupNodeEvents function), it should reflect as is in the final config.How has the user experience changed?
User will get the exact config they supply in the
setupNodeEvents
function.PR Tasks
cypress-documentation
?type definitions
?