@@ -487,29 +487,31 @@ function run(options = kEmptyObject) {
487487 }
488488
489489 const root = createTestTree ( { __proto__ : null , concurrency, timeout, signal } ) ;
490- let testFiles = files ?? createTestFileList ( ) ;
490+ if ( process . env . NODE_TEST_CONTEXT === undefined ) {
491+ let testFiles = files ?? createTestFileList ( ) ;
491492
492- if ( shard ) {
493- testFiles = ArrayPrototypeFilter ( testFiles , ( _ , index ) => index % shard . total === shard . index - 1 ) ;
494- }
493+ if ( shard ) {
494+ testFiles = ArrayPrototypeFilter ( testFiles , ( _ , index ) => index % shard . total === shard . index - 1 ) ;
495+ }
495496
496- let postRun = ( ) => root . postRun ( ) ;
497- let filesWatcher ;
498- const opts = { __proto__ : null , root, signal, inspectPort, testNamePatterns, only } ;
499- if ( watch ) {
500- filesWatcher = watchFiles ( testFiles , opts ) ;
501- postRun = undefined ;
502- }
503- const runFiles = ( ) => {
504- root . harness . bootstrapComplete = true ;
505- return SafePromiseAllSettledReturnVoid ( testFiles , ( path ) => {
506- const subtest = runTestFile ( path , filesWatcher , opts ) ;
507- filesWatcher ?. runningSubtests . set ( path , subtest ) ;
508- return subtest ;
509- } ) ;
510- } ;
497+ let postRun = ( ) => root . postRun ( ) ;
498+ let filesWatcher ;
499+ const opts = { __proto__ : null , root, signal, inspectPort, testNamePatterns, only } ;
500+ if ( watch ) {
501+ filesWatcher = watchFiles ( testFiles , opts ) ;
502+ postRun = undefined ;
503+ }
504+ const runFiles = ( ) => {
505+ root . harness . bootstrapComplete = true ;
506+ return SafePromiseAllSettledReturnVoid ( testFiles , ( path ) => {
507+ const subtest = runTestFile ( path , filesWatcher , opts ) ;
508+ filesWatcher ?. runningSubtests . set ( path , subtest ) ;
509+ return subtest ;
510+ } ) ;
511+ } ;
511512
512- PromisePrototypeThen ( PromisePrototypeThen ( PromiseResolve ( setup ?. ( root ) ) , runFiles ) , postRun ) ;
513+ PromisePrototypeThen ( PromisePrototypeThen ( PromiseResolve ( setup ?. ( root ) ) , runFiles ) , postRun ) ;
514+ }
513515
514516 return root . reporter ;
515517}
0 commit comments