@@ -7,6 +7,8 @@ const { test } = require('node:test');
77
88const fixture1 = fixtures . path ( 'test-runner' , 'no-isolation' , 'one.test.js' ) ;
99const fixture2 = fixtures . path ( 'test-runner' , 'no-isolation' , 'two.test.js' ) ;
10+ const asyncBuildFilteredSuite =
11+ fixtures . path ( 'test-runner' , 'filtered-suite-async-build.mjs' ) ;
1012
1113test ( 'works with --test-only' , ( ) => {
1214 const args = [
@@ -71,6 +73,27 @@ test('works with --test-name-pattern', () => {
7173 assert . match ( stdout , / # s u i t e s 0 / ) ;
7274} ) ;
7375
76+ test ( 'filtered suites with an async build do not leave cancelled tests' , ( ) => {
77+ const args = [
78+ '--test' ,
79+ '--test-reporter=tap' ,
80+ '--test-isolation=none' ,
81+ '--test-name-pattern=C' ,
82+ asyncBuildFilteredSuite ,
83+ ] ;
84+ const child = spawnSync ( process . execPath , args ) ;
85+ const stdout = child . stdout . toString ( ) ;
86+
87+ assert . strictEqual ( child . status , 0 ) ;
88+ assert . strictEqual ( child . signal , null ) ;
89+ assert . match ( stdout , / # t e s t s 1 / ) ;
90+ assert . match ( stdout , / # s u i t e s 2 / ) ;
91+ assert . match ( stdout , / # p a s s 1 / ) ;
92+ assert . match ( stdout , / # f a i l 0 / ) ;
93+ assert . match ( stdout , / # c a n c e l l e d 0 / ) ;
94+ assert . doesNotMatch ( stdout , / p a r e n t A l r e a d y F i n i s h e d / ) ;
95+ } ) ;
96+
7497test ( 'works with --test-skip-pattern' , ( ) => {
7598 const args = [
7699 '--test' ,
0 commit comments