Skip to content
Advertisement

Is there a reliable way to have Cypress exit as soon as a test fails?

We have a large test suite running on a CI server, and there appears to be no way of telling Cypress to exit if a test fails. It always runs the entire suite.

There is some discussion here, but no workable solution.

Is there a reliable way to have Cypress exit as soon as a test fails?

Advertisement

Answer

As you’ve mentioned, it’s not officially supported yet (as of 3.6.0).

Here’s my take at a hack (without the use of cookies and such for keeping state):

JavaScript
JavaScript

Will skip all further tests once a failure is encountered. The output will look like:

enter image description here

User contributions licensed under: CC BY-SA
6 People found this is helpful
Advertisement