Skip to content

Commit

Permalink
Fix timeout reporting in TAP reporter
Browse files Browse the repository at this point in the history
Fixes #2612 

Co-authored-by: Daudov, Tymur <tymur.daudov@f-secure.com>
  • Loading branch information
tymfear and Daudov, Tymur committed Dec 31, 2020
1 parent 3fe4c40 commit 98595da
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion lib/reporters/tap.js
Expand Up @@ -131,6 +131,16 @@ class TapReporter {
}
}

writeTimeout(evt) {
const err = new Error(`Exited because no new tests completed within the last ${evt.period}ms of inactivity`);

for (const [testFile, tests] of evt.pendingTests) {
for (const title of tests) {
this.writeTest({testFile, title, err}, {passed: false, todo: false, skip: false});
}
}
}

consumeStateChange(evt) { // eslint-disable-line complexity
const fileStats = this.stats && evt.testFile ? this.stats.byFile.get(evt.testFile) : null;

Expand Down Expand Up @@ -172,7 +182,7 @@ class TapReporter {
this.writeTest(evt, {passed: true, todo: false, skip: false});
break;
case 'timeout':
this.writeCrash(evt, `Exited because no new tests completed within the last ${evt.period}ms of inactivity`);
this.writeTimeout(evt);
break;
case 'uncaught-exception':
this.writeCrash(evt);
Expand Down

0 comments on commit 98595da

Please sign in to comment.