File tree Expand file tree Collapse file tree 6 files changed +83
-8
lines changed
fixtures/test-runner/output Expand file tree Collapse file tree 6 files changed +83
-8
lines changed Original file line number Diff line number Diff line change @@ -503,7 +503,8 @@ class Test extends AsyncResource {
503503 this . endTime = hrtime ( ) ;
504504 this . passed = false ;
505505 this . error = err ;
506- if ( bail ) {
506+ 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 }
Original file line number Diff line number Diff line change 1+ // Flags: --test-bail --test-reporter=tap
2+ 'use strict' ;
3+ const common = require ( '../../../common' ) ;
4+ const assert = require ( 'assert' ) ;
5+ const test = require ( 'node:test' ) ;
6+
7+ test ( 'keep error' , ( t ) => {
8+ assert . strictEqual ( 0 , 1 ) ;
9+ } ) ;
10+
11+ test ( 'dont show' , common . mustNotCall ( ( t ) => {
12+ assert . strictEqual ( 0 , 2 ) ;
13+ } ) ) ;
Original file line number Diff line number Diff line change 1+ TAP version 13
2+ not ok 1 - keep error
3+ ---
4+ duration_ms: *
5+ location: '/test/fixtures/test-runner/output/bail-error.js:(LINE):1'
6+ failureType: 'testCodeFailure'
7+ error: |-
8+ Expected values to be strictly equal:
9+
10+ 0 !== 1
11+
12+ code: 'ERR_ASSERTION'
13+ name: 'AssertionError'
14+ expected: 1
15+ actual: 0
16+ operator: 'strictEqual'
17+ stack: |-
18+ *
19+ *
20+ *
21+ *
22+ *
23+ ...
24+ 1..2
25+ # tests 2
26+ # suites 0
27+ # pass 0
28+ # fail 1
29+ # cancelled 1
30+ # skipped 0
31+ # todo 0
32+ # duration_ms *
Original file line number Diff line number Diff line change 1- // Flags: --test --test-bail
1+ // Flags: --test-bail --test-reporter=tap
22'use strict' ;
33const common = require ( '../../../common' ) ;
44const test = require ( 'node:test' ) ;
Original file line number Diff line number Diff line change 1+ TAP version 13
2+ # Subtest: nested
3+ # Subtest: first
4+ ok 1 - first
5+ ---
6+ duration_ms: *
7+ ...
8+ not ok 2 - second
9+ ---
10+ duration_ms: *
11+ location: '/test/fixtures/test-runner/output/bail.js:(LINE):5'
12+ failureType: 'cancelledByParent'
13+ error: 'test did not finish before its parent and was cancelled'
14+ code: 'ERR_TEST_FAILURE'
15+ ...
16+ 1..3
17+ not ok 1 - nested
18+ ---
19+ duration_ms: *
20+ location: '/test/fixtures/test-runner/output/bail.js:(LINE):1'
21+ failureType: 'subtestsFailed'
22+ error: '2 subtests failed'
23+ code: 'ERR_TEST_FAILURE'
24+ ...
25+ 1..2
26+ # tests 5
27+ # suites 0
28+ # pass 1
29+ # fail 2
30+ # cancelled 2
31+ # skipped 0
32+ # todo 0
33+ # duration_ms *
Original file line number Diff line number Diff line change @@ -88,6 +88,8 @@ const tests = [
8888 replaceTestDuration ,
8989 ) ,
9090 } ,
91+ { name : 'test-runner/output/bail.js' , tty : true } ,
92+ { name : 'test-runner/output/bail-error.js' , tty : true } ,
9193]
9294. filter ( Boolean )
9395. map ( ( { name, tty, transform } ) => ( {
You can’t perform that action at this time.
0 commit comments