@@ -8,7 +8,6 @@ import assert from 'node:assert';
88const testFixtures = fixtures . path ( 'test-runner' ) ;
99
1010describe ( 'require(\'node:test\').run' , { concurrency : true } , ( ) => {
11-
1211 it ( 'should run with no tests' , async ( ) => {
1312 const stream = run ( { files : [ ] } ) ;
1413 stream . on ( 'test:fail' , common . mustNotCall ( ) ) ;
@@ -65,13 +64,6 @@ describe('require(\'node:test\').run', { concurrency: true }, () => {
6564 for await ( const _ of stream ) ;
6665 } ) ;
6766
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-
7567 it ( 'should be piped with dot' , async ( ) => {
7668 const result = await run ( {
7769 files : [ join ( testFixtures , 'default-behavior/test/random.cjs' ) ]
@@ -437,4 +429,20 @@ describe('require(\'node:test\').run', { concurrency: true }, () => {
437429 assert . deepStrictEqual ( executedTestFiles . sort ( ) , [ ...shardsTestsFiles ] . sort ( ) ) ;
438430 } ) ;
439431 } ) ;
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+ } ) ;
440448} ) ;
0 commit comments