Skip to content

Instantly share code, notes, and snippets.

@silvawillian
Created December 4, 2019 15:16
Show Gist options
  • Save silvawillian/388479c322769ff0b22b461a0ca6b16c to your computer and use it in GitHub Desktop.
Save silvawillian/388479c322769ff0b22b461a0ca6b16c to your computer and use it in GitHub Desktop.
/* eslint-disable */
beforeEach(function cb() {
if (!this.currentTest.parent.timerStart) {
this.currentTest.parent.timerIndex = 0;
this.currentTest.parent.timerStart = Date.now();
}
});
afterEach(function cb() {
if (this.currentTest.parent.timerStart && ++this.currentTest.parent.timerIndex === this.currentTest.parent.tests.length) {
const elapsedTimeInMs = Date.now() - this.currentTest.parent.timerStart;
if (elapsedTimeInMs >= 1000) {
console.error(`File: "${this.currentTest.file}" - Suite: "${this.currentTest.parent.fullTitle()}" - Elapsed: ${elapsedTimeInMs}ms`);
}
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment