cypress icon indicating copy to clipboard operation
cypress copied to clipboard

fix: Fix Issue 27103. Retain original array after defaultsDeep

Open NiharPhansalkar opened this issue 1 year ago • 13 comments

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 using yarn 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

NiharPhansalkar avatar Jul 08 '23 06:07 NiharPhansalkar

CLA assistant check
All committers have signed the CLA.

CLAassistant avatar Jul 08 '23 06:07 CLAassistant

cypress-app-bot avatar Jul 08 '23 06:07 cypress-app-bot

1 failed and 29 flaky tests on run #48661 ↗︎

1 27936 1349 0 Flakiness 29

Details:

Merge branch 'cypress-io:develop' into issue-27103-defaultsDeep-array-combinatio...
Project: cypress Commit: b7e30a42d0
Status: Failed Duration: 20:08 💡
Started: Jul 8, 2023 10:48 AM Ended: Jul 8, 2023 11:09 AM
Failed  cypress/e2e/e2e/origin/user_agent_override.cy.ts • 1 failed test • 5x-driver-electron

View Output Video

Test Artifacts
user agent override > persists modified user agent after cy.go Output Video
Flakiness  runs.cy.ts • 1 flaky test • app-e2e

View Output Video

Test Artifacts
... > displays a list of recorded runs if a run has been recorded Output Screenshots Video
Flakiness  specs_list_latest_runs.cy.ts • 1 flaky test • app-e2e

View Output Video

Test Artifacts
App/Cloud Integration - Latest runs and Average duration > when no runs are recorded > shows placeholders for all visible specs Output Screenshots Video
Flakiness  cypress-origin-communicator.cy.ts • 1 flaky test • app-e2e

View Output Video

Test Artifacts
Cypress In Cypress Origin Communicator > cy.origin passivity with app interactions > passes upon test reload mid test execution Output Screenshots Video
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  commands/net_stubbing.cy.ts • 1 flaky test • 5x-driver-electron

View Output Video

Test Artifacts
network stubbing > intercepting request > can delay and throttle a StaticResponse Output Video

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.

cypress[bot] avatar Jul 08 '23 07:07 cypress[bot]

Let me run CI and see how it goes.

lmiller1990 avatar Jul 12 '23 00:07 lmiller1990

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 yarn complete when you first clone the repo? Note you must use Chrome for the packages/app tests.

Are you able to run other tests - try yarn cypress:open in packages/app and choose Component Testing -- do those run?

lmiller1990 avatar Jul 12 '23 00:07 lmiller1990

@lmiller1990 Hello, I am running this in a VM running Fedora 38. Yes yarn does complete (however, one catch is I had to disable the NX daemon in order for it to work properly) and yes I ran it on Google Chrome. However, when I select component testing, it says the following

Cannot convert undefined or null to object

TypeError: Cannot convert undefined or null to object
    at Function.entries ()
    at updateWithPluginValues (/home/vm_work/cypress/packages/config/src/project/index.ts:113:37)
    at ProjectConfigManager.handleSetupTestingTypeReply (/home/vm_work/cypress/packages/data-context/src/data/ProjectConfigManager.ts:333:73)
    at ProjectConfigManager.setupNodeEvents (/home/vm_work/cypress/packages/data-context/src/data/ProjectConfigManager.ts:267:7)

NiharPhansalkar avatar Jul 12 '23 01:07 NiharPhansalkar

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 avatar Jul 12 '23 01:07 NiharPhansalkar

@NiharPhansalkar I think we need a default value: https://github.com/cypress-io/cypress/pull/27240/commits/1deb871738a12051c006f7c52f2731deefb26f3b

It was trying to do Object.entries(undefined). Let's see how this goes.

lmiller1990 avatar Jul 12 '23 22:07 lmiller1990

@lmiller1990 Hello Lachlan, the cy.startAppServer() keeps on giving me a timeout error when I try to run the e2e tests. I even tried commenting out some code, but of course, other things start breaking.

NiharPhansalkar avatar Jul 13 '23 02:07 NiharPhansalkar

I'll try and get this one merged up.

lmiller1990 avatar Jul 14 '23 01:07 lmiller1990

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?

NiharPhansalkar avatar Jul 14 '23 01:07 NiharPhansalkar

Right, I understand your question.

VM running Fedora 38.

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 DEBUG=cypress:* yarn dev and see what comes up in the logs. I have run the development scripts on Ubuntu, MacOS and windows before. If you'd like to give that a try and see if there's anything useful in the debug logs.

lmiller1990 avatar Jul 14 '23 02:07 lmiller1990

Sure! Thank you.

NiharPhansalkar avatar Jul 14 '23 02:07 NiharPhansalkar

@lmiller1990 Hello Lachlan. I did run it with DEBUG=* yarn dev and there were quite a few errors. Can you tell me if you too have received such errors?

  1. cypress:ts registering ts-node on directory undefined
  2. nexusTypegen: cypress:ts registering ts-node on directory undefined'
  3. cypress:server environment error Cannot read properties of undefined (reading 'commandLine')
  4. cypress:packherd:error Error: Cannot find module 'pnpapi' (Lot of packherd errors)
  5. NexusSlowGuard: Taking more than 100ms to execute ["currentProject","projectId"] for query HeaderBar_HeaderBarQuery (total time 161ms)

NiharPhansalkar avatar Jul 16 '23 03:07 NiharPhansalkar

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.

logs.txt

lmiller1990 avatar Jul 17 '23 00:07 lmiller1990

Close in favor of https://github.com/cypress-io/cypress/pull/27312

lmiller1990 avatar Jul 17 '23 05:07 lmiller1990