Bug
Documented code for Debugging when a test fails does not leave the test as a failure.
Referenced documentation https://docs.cypress.io/api/events/catalog-of-events.html#Catching-Test-Failures
Tests with failures still shown as failures in the log.
Add the following to support/index.js file:
Cypress.on('fail', (err, runnable) => {
debugger
})
Create a test that fails and run it
Note: Adding runnable.emit('error', err);
to the above event binding will have the error message show in log but does not mark the test as a failure.
OS: Windows 7
Browser: Chrome 66
Cypress: 3.1.0
Confirm, I had to adjust the code for the test to fail
Cypress.on("fail", (err, runnable) => {
debugger
return err
})
cc @scottcrowe
Also beware that if you use cypress-webpack-preprocessor, it's stripping debugger
statements with default options
(spend more that little time debugging this)
https://github.com/cypress-io/cypress-webpack-preprocessor/issues/29
I created a new issue in our docs to document how to fail a test after listening to 'fail' events here: https://github.com/cypress-io/cypress-documentation/issues/1045. Our documentation is open source and contributions are welcome. 馃槃
Since this seems to be a documentation issue and not an actual issue with Cypress's implementation, I will close this issue.
Most helpful comment
I created a new issue in our docs to document how to fail a test after listening to 'fail' events here: https://github.com/cypress-io/cypress-documentation/issues/1045. Our documentation is open source and contributions are welcome. 馃槃
Since this seems to be a documentation issue and not an actual issue with Cypress's implementation, I will close this issue.