cypress-io / cypress

Fast, easy and reliable testing for anything that runs in a browser.
https://cypress.io
MIT License
46.84k stars 3.17k forks source link

Cypress crashes while executing a spec containing several dozens of tests #25949

Closed vitaliy4us closed 1 year ago

vitaliy4us commented 1 year ago

Current behavior

Cypress Test Runner starts working extremely unstable and crashes in 70% of runs if number of tests in a spec file is several dozens (in my case was tested for 45 tests). Reducing a number of tests to be kept in memory to 20 (option numTestsKeptInMemory in config file) did not resolve the issue. Error code: Out of Memory

Desired behavior

Cypress should work stable and its documentation should have information about restrictions regarding the number of tests containing in a spec file.

Test code to reproduce

const allData = [
  {
      key0 : val0_0,
      key1 : val1_0,
      key2 : val2_0,
      key3 : val3_0,
      key4 : val4_0,
      key5 : val5_0,
      key6 : val6_0,
      key7 : val7_0,
      key8 : val8_0,
  },
  ........................................
  {
      key0 : val0_8,
      key1 : val1_8,
      key2 : val2_8,
      key3 : val3_8,
      key4 : val4_8,
      key5 : val5_8,
      key6 : val6_8,
      key7 : val7_8,
      key8 : val8_8,
  }
]

allData.forEach((data,i) => {
  context('context1', () => {
    it('Test 1-1', () => {
      // commands
    })

    it('Test 1-2', () => {
       // commands
    })
  })

context('context2', () => {
    it('Test 2-1', () => {
      // commands
    })

    it('Test 2-2', () => {
       // commands
    })

    it('Test 2-3', () => {
       // commands
    })
  })
})

Cypress Version

12.0

Node version

16.14

Operating System

Windows 10 Professional

Debug Logs

No response

Other

Cypress crash
MikeMcC399 commented 1 year ago

@vitaliy4us

You might be interested in Cypress 12.4.0 which says:

"Added new experimentalMemoryManagement configuration option to improve memory management in Chromium-based browsers. Enable this option with experimentalMemoryManagement=true if you have experienced "Out of Memory" issues."

nagash77 commented 1 year ago

@MikeMcC399 thank you for that reply! I was about to suggest the same flag.

@vitaliy4us let us know if that helps your problem.

MikeMcC399 commented 1 year ago

@vitaliy4us

By the way, I wasn't suggesting that you use exactly 12.4.0. You should consider migrating to a minimum of 12.4.0, which could be 12.7.0 for instance. Try it out anyway!

nagash77 commented 1 year ago

I am going to close this issue as resolved. If you have further problems please feel free to comment on this ticket and we can reopen.