Skip to content

Commit

Permalink
fix: Cypress v9.2.0 incompatibility (#299)
Browse files Browse the repository at this point in the history
If you have a test that calls `this.skip()`, cypress-failed-log will
throw an "Cannot read properties of undefined (reading 'message')"
exception. If there's multiple such tests, it just stalls forever.

This is due to a change in Cypress 9.2.0 where it no longer triggers the
"failed" event for skipped tests:
cypress-io/cypress@4a97a52
  • Loading branch information
MasonM authored Jan 31, 2024
1 parent 644797d commit 35899df
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
11 changes: 11 additions & 0 deletions cypress/e2e/test-skipping.cy.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
describe('cypress skipped tests', () => {
it.skip('Skipping using it.skip', () => {})

it('Skipping using this.skip()', function() {
this.skip();
})

it('Skipping using this.skip() again', function() {
this.skip();
})
})
2 changes: 1 addition & 1 deletion src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ function initLog () {

function onFailed () {
savingCommands = false
if (this.currentTest.state === 'passed') {
if (this.currentTest.state === 'passed' || this.currentTest.state === 'pending') {
return
}
const testName = this.currentTest.fullTitle()
Expand Down

0 comments on commit 35899df

Please sign in to comment.