Skip to content

Commit c4e3654

Browse files
fix: more bailout
1 parent c400ed1 commit c4e3654

File tree

3 files changed

+9
-9
lines changed

3 files changed

+9
-9
lines changed

lib/internal/test_runner/reporter/tap.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ async function * tapReporter(source) {
6464
yield getCoverageReport(indent(data.nesting), data.summary, '# ', '');
6565
break;
6666
case 'test:bail':
67-
yield `Bail out! ${tapEscape(data.reason)}\n`;
67+
yield `${indent(data.nesting)}Bail out! ${tapEscape(data.reason)}\n`;
6868
break;
6969
}
7070
}

lib/internal/test_runner/test.js

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -504,6 +504,7 @@ class Test extends AsyncResource {
504504
this.passed = false;
505505
this.error = err;
506506
if (bail && !this.root.bailedOut) {
507+
this.bailedOut = true;
507508
this.root.bailedOut = true;
508509
this.root.postRun();
509510
}
@@ -582,12 +583,6 @@ class Test extends AsyncResource {
582583
}
583584

584585
async run() {
585-
if (bailedOut) {
586-
if (this.parent !== null) {
587-
this.parent.postRun();
588-
}
589-
return;
590-
}
591586
if (this.parent !== null) {
592587
this.parent.activeSubtests++;
593588
}
@@ -727,6 +722,10 @@ class Test extends AsyncResource {
727722
this.parent.processReadySubtestRange(false);
728723
this.parent.processPendingSubtests();
729724

725+
if (this.bailedOut) {
726+
this.reporter.bail(this.nesting);
727+
}
728+
730729
if (this.parent === this.root &&
731730
this.root.activeSubtests === 0 &&
732731
this.root.pendingSubtests.length === 0 &&
@@ -754,7 +753,7 @@ class Test extends AsyncResource {
754753
reporter.diagnostic(nesting, loc, diagnostics[i]);
755754
}
756755

757-
if(this.bailedOut){
756+
if (this.bailedOut) {
758757
reporter.bail();
759758
}
760759

lib/internal/test_runner/tests_stream.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,9 +62,10 @@ class TestsStream extends Readable {
6262
});
6363
}
6464

65-
bail(reason = ''){
65+
bail(nesting, reason = '') {
6666
this[kEmitMessage]('test:bail', {
6767
__proto__: null,
68+
nesting,
6869
reason,
6970
});
7071
}

0 commit comments

Comments
 (0)