File tree 4 files changed +80
-3
lines changed
fixtures/test-runner/output
4 files changed +80
-3
lines changed Original file line number Diff line number Diff line change @@ -1181,15 +1181,15 @@ class Suite extends Test {
1181
1181
) ;
1182
1182
} catch ( err ) {
1183
1183
this . fail ( new ERR_TEST_FAILURE ( err , kTestCodeFailure ) ) ;
1184
-
1185
- this . buildPhaseFinished = true ;
1184
+ this . postBuild ( ) ;
1186
1185
}
1187
1186
this . fn = noop ;
1188
1187
}
1189
1188
1190
1189
postBuild ( ) {
1191
1190
this . buildPhaseFinished = true ;
1192
- if ( this . filtered && this . filteredSubtestCount !== this . subtests . length ) {
1191
+ if ( this . filtered &&
1192
+ ( this . filteredSubtestCount !== this . subtests . length || this . error ) ) {
1193
1193
// A suite can transition from filtered to unfiltered based on the
1194
1194
// tests that it contains - in case of children matching patterns.
1195
1195
this . filtered = false ;
Original file line number Diff line number Diff line change
1
+ // Flags: --test-name-pattern=enabled
2
+ 'use strict' ;
3
+ const common = require ( '../../../common' ) ;
4
+ const { suite, test } = require ( 'node:test' ) ;
5
+
6
+ suite ( 'suite 1' , ( ) => {
7
+ throw new Error ( 'boom 1' ) ;
8
+ test ( 'enabled - should not run' , common . mustNotCall ( ) ) ;
9
+ } ) ;
10
+
11
+ suite ( 'suite 2' , ( ) => {
12
+ test ( 'enabled - should get cancelled' , common . mustNotCall ( ) ) ;
13
+ throw new Error ( 'boom 1' ) ;
14
+ } ) ;
Original file line number Diff line number Diff line change
1
+ TAP version 13
2
+ # Subtest: suite 1
3
+ not ok 1 - suite 1
4
+ ---
5
+ duration_ms: *
6
+ type: 'suite'
7
+ location: '/test/fixtures/test-runner/output/filtered-suite-throws.js:(LINE):1'
8
+ failureType: 'testCodeFailure'
9
+ error: 'boom 1'
10
+ code: 'ERR_TEST_FAILURE'
11
+ stack: |-
12
+ *
13
+ *
14
+ *
15
+ *
16
+ *
17
+ *
18
+ *
19
+ *
20
+ *
21
+ *
22
+ ...
23
+ # Subtest: suite 2
24
+ # Subtest: enabled - should get cancelled
25
+ not ok 1 - enabled - should get cancelled
26
+ ---
27
+ duration_ms: *
28
+ location: '/test/fixtures/test-runner/output/filtered-suite-throws.js:(LINE):3'
29
+ failureType: 'cancelledByParent'
30
+ error: 'test did not finish before its parent and was cancelled'
31
+ code: 'ERR_TEST_FAILURE'
32
+ ...
33
+ 1..1
34
+ not ok 2 - suite 2
35
+ ---
36
+ duration_ms: *
37
+ type: 'suite'
38
+ location: '/test/fixtures/test-runner/output/filtered-suite-throws.js:(LINE):1'
39
+ failureType: 'testCodeFailure'
40
+ error: 'boom 1'
41
+ code: 'ERR_TEST_FAILURE'
42
+ stack: |-
43
+ *
44
+ *
45
+ *
46
+ *
47
+ *
48
+ *
49
+ *
50
+ *
51
+ *
52
+ *
53
+ ...
54
+ 1..2
55
+ # tests 1
56
+ # suites 2
57
+ # pass 0
58
+ # fail 0
59
+ # cancelled 1
60
+ # skipped 0
61
+ # todo 0
62
+ # duration_ms *
Original file line number Diff line number Diff line change @@ -101,6 +101,7 @@ const tests = [
101
101
{ name : 'test-runner/output/eval_dot.js' , transform : specTransform } ,
102
102
{ name : 'test-runner/output/eval_spec.js' , transform : specTransform } ,
103
103
{ name : 'test-runner/output/eval_tap.js' } ,
104
+ { name : 'test-runner/output/filtered-suite-throws.js' } ,
104
105
{ name : 'test-runner/output/hooks.js' } ,
105
106
{ name : 'test-runner/output/hooks_spec_reporter.js' , transform : specTransform } ,
106
107
{ name : 'test-runner/output/skip-each-hooks.js' , transform : specTransform } ,
You can’t perform that action at this time.
0 commit comments