@@ -109,7 +109,7 @@ function createTestFileList(patterns) {
109
109
110
110
function filterExecArgv ( arg , i , arr ) {
111
111
return ! ArrayPrototypeIncludes ( kFilterArgs , arg ) &&
112
- ! ArrayPrototypeSome ( kFilterArgValues , ( p ) => arg === p || ( i > 0 && arr [ i - 1 ] === p ) || StringPrototypeStartsWith ( arg , `${ p } =` ) ) ;
112
+ ! ArrayPrototypeSome ( kFilterArgValues , ( p ) => arg === p || ( i > 0 && arr [ i - 1 ] === p ) || StringPrototypeStartsWith ( arg , `${ p } =` ) ) ;
113
113
}
114
114
115
115
function getRunArgs ( path , { forceExit, inspectPort, testNamePatterns, testSkipPatterns, only } ) {
@@ -166,7 +166,7 @@ class FileTest extends Test {
166
166
if ( firstSpaceIndex === - 1 ) return false ;
167
167
const secondSpaceIndex = StringPrototypeIndexOf ( comment , ' ' , firstSpaceIndex + 1 ) ;
168
168
return secondSpaceIndex === - 1 &&
169
- ArrayPrototypeIncludes ( kDiagnosticsFilterArgs , StringPrototypeSlice ( comment , 0 , firstSpaceIndex ) ) ;
169
+ ArrayPrototypeIncludes ( kDiagnosticsFilterArgs , StringPrototypeSlice ( comment , 0 , firstSpaceIndex ) ) ;
170
170
}
171
171
#handleReportItem( item ) {
172
172
const isTopLevel = item . data . nesting === 0 ;
@@ -416,7 +416,22 @@ function watchFiles(testFiles, opts) {
416
416
const watcher = new FilesWatcher ( { __proto__ : null , debounce : 200 , mode : 'filter' , signal : opts . signal } ) ;
417
417
const filesWatcher = { __proto__ : null , watcher, runningProcesses, runningSubtests } ;
418
418
opts . root . harness . watching = true ;
419
+ // Watch for created/deleted files in the current directory
420
+ const allFilesWatcher = new FilesWatcher ( { __proto__ : null , debounce : 200 , mode : 'all' } ) ;
421
+ allFilesWatcher . watchPath ( process . cwd ( ) ) ;
422
+ allFilesWatcher . on ( 'changed' , ( { owners, eventType } ) => {
423
+ if ( eventType === 'rename' ) {
424
+ const updatedTestFiles = createTestFileList ( opts . globPatterns ) ;
425
+
426
+ const newFiles = ArrayPrototypeFilter ( updatedTestFiles , ( x ) => ! ArrayPrototypeIncludes ( testFiles , x ) ) ;
419
427
428
+ testFiles = updatedTestFiles ;
429
+ newFiles . forEach ( ( newFile ) => {
430
+ watcher . emit ( 'changed' , { __proto__ : null , owners : new SafeSet ( ) . add ( newFile ) , eventType : 'rename' } ) ;
431
+ } ) ;
432
+ }
433
+ } ) ;
434
+ // Watch for changes in current filtered files
420
435
watcher . on ( 'changed' , ( { owners, eventType } ) => {
421
436
if ( ! opts . hasFiles && eventType === 'rename' ) {
422
437
const updatedTestFiles = createTestFileList ( opts . globPatterns ) ;
0 commit comments