Last active
September 11, 2022 07:35
-
-
Save agoldis/014b4020c8a64d2ca7ea8bb9d27c4c0b to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const failOnTimeout = (timeout = 10000) => { | |
return setTimeout(() => { | |
Cypress.runner.stop(); | |
throw new Error("Timeout"); | |
}, timeout); | |
}; | |
describe("All tests", function () { | |
before(failOnTimeout); | |
it('', () => { | |
// .... | |
}); | |
} | |
// an alternative approach - monkey-patch "describe" | |
const _describe = describe; | |
describe = function (title, fn) { | |
failOnTimeout(); | |
_describe.apply(this, [title, fn]); | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment