Mithun Shreevatsa
Mithun Shreevatsa

Reputation: 3619

Cypress retries and npm fast fail not working together

describe('Test', 
     {
      retries: { runMode: 2, openMode: 1 },
      failFast: {
        enabled: true
      }
    }, () => {

   // some tests here

}):

With the above configuration, retries are not working. If any test fails, the following tests are getting skipped.

cypress.config.ts is as follows:

async setupNodeEvents(on, config) {
      require('cypress-fail-fast/plugin')(on, config);

      config.env.FAIL_FAST_STRATEGY = 'spec';
      config.env.FAIL_FAST_ENABLED = false;

});

What's the correct way of configuring both to work together without skipping further tests and try to re-run any fails in between?

Upvotes: -3

Views: 264

Answers (1)

Genevieve OR
Genevieve OR

Reputation: 200

You have missed out a vital step, you must return the config object that has been altered - otherwise Cypress knows nothing about your changes

async setupNodeEvents(on, config) {
  require('cypress-fail-fast/plugin')(on, config);

  config.env.FAIL_FAST_STRATEGY = 'spec';
  config.env.FAIL_FAST_ENABLED = false;

  return config
})

Reference

  // IMPORTANT return the updated config object
  return config

Upvotes: 5

Related Questions