@@ -23,6 +23,42 @@ for (const isolation of ['none', 'process']) {
2323 assert . match ( child . stderr . toString ( ) , / ^ C o u l d n o t f i n d / ) ;
2424 }
2525
26+ {
27+ // A file that is not found should error even when other patterns match.
28+ const args = [
29+ '--test' ,
30+ `--test-isolation=${ isolation } ` ,
31+ 'a-random-file-that-does-not-exist.js' ,
32+ join ( testFixtures , 'default-behavior/test/random.cjs' ) ,
33+ ] ;
34+ const child = spawnSync ( process . execPath , args ) ;
35+
36+ assert . strictEqual ( child . status , 1 ) ;
37+ assert . strictEqual ( child . signal , null ) ;
38+ assert . strictEqual ( child . stdout . toString ( ) , '' ) ;
39+ assert . match ( child . stderr . toString ( ) ,
40+ / ^ C o u l d n o t f i n d ' a - r a n d o m - f i l e - t h a t - d o e s - n o t - e x i s t \. j s ' / ) ;
41+ }
42+
43+ {
44+ // Options after positional arguments are treated as patterns and should
45+ // error instead of being silently dropped.
46+ const args = [
47+ '--test' ,
48+ `--test-isolation=${ isolation } ` ,
49+ join ( testFixtures , 'default-behavior/test/random.cjs' ) ,
50+ '--test-reporter' ,
51+ 'tap' ,
52+ ] ;
53+ const child = spawnSync ( process . execPath , args ) ;
54+
55+ assert . strictEqual ( child . status , 1 ) ;
56+ assert . strictEqual ( child . signal , null ) ;
57+ assert . strictEqual ( child . stdout . toString ( ) , '' ) ;
58+ assert . match ( child . stderr . toString ( ) ,
59+ / ^ C o u l d n o t f i n d ' - - t e s t - r e p o r t e r , t a p ' / ) ;
60+ }
61+
2662 {
2763 // Default behavior. node_modules is ignored. Files that don't match the
2864 // pattern are ignored except in test/ directories.
0 commit comments