Skip to content

Commit 35899df

Browse files
authored
fix: Cypress v9.2.0 incompatibility (#299)
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
1 parent 644797d commit 35899df

File tree

2 files changed

+12
-1
lines changed

2 files changed

+12
-1
lines changed

cypress/e2e/test-skipping.cy.js

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
describe('cypress skipped tests', () => {
2+
it.skip('Skipping using it.skip', () => {})
3+
4+
it('Skipping using this.skip()', function() {
5+
this.skip();
6+
})
7+
8+
it('Skipping using this.skip() again', function() {
9+
this.skip();
10+
})
11+
})

src/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@ function initLog () {
117117

118118
function onFailed () {
119119
savingCommands = false
120-
if (this.currentTest.state === 'passed') {
120+
if (this.currentTest.state === 'passed' || this.currentTest.state === 'pending') {
121121
return
122122
}
123123
const testName = this.currentTest.fullTitle()

0 commit comments

Comments
 (0)