Skip to content

Instantly share code, notes, and snippets.

@agoldis
Last active September 11, 2022 07:35
Show Gist options
  • Save agoldis/014b4020c8a64d2ca7ea8bb9d27c4c0b to your computer and use it in GitHub Desktop.
Save agoldis/014b4020c8a64d2ca7ea8bb9d27c4c0b to your computer and use it in GitHub Desktop.
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