@@ -12,10 +12,7 @@ import exit = require('exit');
1212import slash = require( 'slash' ) ;
1313import type { TestContext } from '@jest/test-result' ;
1414import type { Config } from '@jest/types' ;
15- import type {
16- ChangeEvent as HasteChangeEvent ,
17- default as HasteMap ,
18- } from 'jest-haste-map' ;
15+ import type { IHasteMap as HasteMap } from 'jest-haste-map' ;
1916import { formatExecError } from 'jest-message-util' ;
2017import {
2118 isInteractive ,
@@ -243,31 +240,28 @@ export default async function watch(
243240 emitFileChange ( ) ;
244241
245242 hasteMapInstances . forEach ( ( hasteMapInstance , index ) => {
246- hasteMapInstance . on (
247- 'change' ,
248- ( { eventsQueue, hasteFS, moduleMap} : HasteChangeEvent ) => {
249- const validPaths = eventsQueue . filter ( ( { filePath} ) =>
250- isValidPath ( globalConfig , filePath ) ,
251- ) ;
243+ hasteMapInstance . on ( 'change' , ( { eventsQueue, hasteFS, moduleMap} ) => {
244+ const validPaths = eventsQueue . filter ( ( { filePath} ) =>
245+ isValidPath ( globalConfig , filePath ) ,
246+ ) ;
252247
253- if ( validPaths . length ) {
254- const context = ( contexts [ index ] = createContext (
255- contexts [ index ] . config ,
256- { hasteFS, moduleMap} ,
257- ) ) ;
258-
259- activePlugin = null ;
260-
261- searchSources = searchSources . slice ( ) ;
262- searchSources [ index ] = {
263- context,
264- searchSource : new SearchSource ( context ) ,
265- } ;
266- emitFileChange ( ) ;
267- startRun ( globalConfig ) ;
268- }
269- } ,
270- ) ;
248+ if ( validPaths . length ) {
249+ const context = ( contexts [ index ] = createContext (
250+ contexts [ index ] . config ,
251+ { hasteFS, moduleMap} ,
252+ ) ) ;
253+
254+ activePlugin = null ;
255+
256+ searchSources = searchSources . slice ( ) ;
257+ searchSources [ index ] = {
258+ context,
259+ searchSource : new SearchSource ( context ) ,
260+ } ;
261+ emitFileChange ( ) ;
262+ startRun ( globalConfig ) ;
263+ }
264+ } ) ;
271265 } ) ;
272266
273267 if ( ! hasExitListener ) {
0 commit comments