cypress-io/cypress-grep

Trying to create a separate simple function for burning all queued tests

alexniculae opened this issue · 3 comments

Hello @bahmutov,

Hope you could help with some advice on something I am trying to build.

I'm looking to create a simple function that can burn all tests Cypress has queued.

I have tried starting from here + here, but I am not able to figure out what I am missing - queued test(s) will run, but without any burn.

Is this something you could maybe share some details on?

Thank you.

@bahmutov, I was thinking to try to implement

  • more or less the same end-functionality that you have created for the cypress-grep plugin, but
  • something that would run via a simple function in the support file
  • without the rest of the complex logic that the cypressGrep() function is building alongside

If I can share a very simplistic example of what I'm thinking of, I'd like to add something like the below snippet in the support file, but I'm missing something that I can't put my finger on (e.g. executing the function and having it working over the queued specs).

const burn = Cypress.env('burn');
const _it = it;

function itGrep(name, options, callback) {
  if (burn > 1) {
    return Cypress._.times(burn, (index) => {
      const fullName = `${name} | burning ${index + 1} of ${burn}`;

      _it(fullName, options, callback);
    });
  }

  return _it(name, options, callback);
}

Thank you.

Closing this issue, as the cypress-grep plugin already allows doing this.

The reason for creating this ticket in the first place was to try to alleviate high memory consumption during a high number of burns for a high number of specs&tests.

After reading more about Cypress memory consumption, the crash I was trying to avoid with the above would have occurred anyway due to the load I was creating.

A bigger machine fixed the issue, as proposed by Gleb (the more tests+burns, the bigger the machine needs to be).