@@ -8,7 +8,6 @@ import assert from 'node:assert';
8
8
const testFixtures = fixtures . path ( 'test-runner' ) ;
9
9
10
10
describe ( 'require(\'node:test\').run' , { concurrency : true } , ( ) => {
11
-
12
11
it ( 'should run with no tests' , async ( ) => {
13
12
const stream = run ( { files : [ ] } ) ;
14
13
stream . on ( 'test:fail' , common . mustNotCall ( ) ) ;
@@ -65,13 +64,6 @@ describe('require(\'node:test\').run', { concurrency: true }, () => {
65
64
for await ( const _ of stream ) ;
66
65
} ) ;
67
66
68
- it ( 'should validate files' , async ( ) => {
69
- [ Symbol ( ) , { } , ( ) => { } , 0 , 1 , 0n , 1n , '' , '1' , Promise . resolve ( [ ] ) , true , false ]
70
- . forEach ( ( files ) => assert . throws ( ( ) => run ( { files } ) , {
71
- code : 'ERR_INVALID_ARG_TYPE'
72
- } ) ) ;
73
- } ) ;
74
-
75
67
it ( 'should be piped with dot' , async ( ) => {
76
68
const result = await run ( {
77
69
files : [ join ( testFixtures , 'default-behavior/test/random.cjs' ) ]
@@ -437,4 +429,20 @@ describe('require(\'node:test\').run', { concurrency: true }, () => {
437
429
assert . deepStrictEqual ( executedTestFiles . sort ( ) , [ ...shardsTestsFiles ] . sort ( ) ) ;
438
430
} ) ;
439
431
} ) ;
432
+
433
+ describe ( 'validation' , ( ) => {
434
+ it ( 'should only allow array in options.files' , async ( ) => {
435
+ [ Symbol ( ) , { } , ( ) => { } , 0 , 1 , 0n , 1n , '' , '1' , Promise . resolve ( [ ] ) , true , false ]
436
+ . forEach ( ( files ) => assert . throws ( ( ) => run ( { files } ) , {
437
+ code : 'ERR_INVALID_ARG_TYPE'
438
+ } ) ) ;
439
+ } ) ;
440
+
441
+ it ( 'should only allow object as options' , ( ) => {
442
+ [ Symbol ( ) , [ ] , ( ) => { } , 0 , 1 , 0n , 1n , '' , '1' , true , false ]
443
+ . forEach ( ( options ) => assert . throws ( ( ) => run ( options ) , {
444
+ code : 'ERR_INVALID_ARG_TYPE'
445
+ } ) ) ;
446
+ } ) ;
447
+ } ) ;
440
448
} ) ;
0 commit comments