@@ -2,21 +2,29 @@ import { join, relative } from "path";
22import  {  cwd  }  from  "node:process" ; 
33import  {  ESLint  }  from  "eslint" ; 
44
5+ // Set timeout to 10s. 
6+ // It is observed that the test takes more than 5s to run, while the default timeout is 5s. 
7+ const  timeout  =  10  *  1000 ; 
8+ 
59function  runTest ( filename )  { 
6-   test ( filename ,  async  ( )  =>  { 
7-     const  cli  =  new  ESLint ( ) ; 
10+   test ( 
11+     filename , 
12+     async  ( )  =>  { 
13+       const  cli  =  new  ESLint ( ) ; 
814
9-     const  lintResults  =  await  cli . lintFiles ( [ join ( "src" ,  filename ) ] ) ; 
10-     // Patch the path so that they are the same on any machine. 
11-     for  ( const  r  of  lintResults )  { 
12-       const  absolute  =  r . filePath ; 
13-       r . filePath  =  relative ( cwd ( ) ,  absolute ) ; 
14-     } 
15+        const  lintResults  =  await  cli . lintFiles ( [ join ( "src" ,  filename ) ] ) ; 
16+        // Patch the path so that they are the same on any machine. 
17+        for  ( const  r  of  lintResults )  { 
18+          const  absolute  =  r . filePath ; 
19+          r . filePath  =  relative ( cwd ( ) ,  absolute ) ; 
20+        } 
1521
16-     const  formatter  =  await  cli . loadFormatter ( "unix" ) ; 
17-     const  actual  =  await  formatter . format ( lintResults ) ; 
18-     expect ( actual ) . toMatchSnapshot ( ) ; 
19-   } ) ; 
22+       const  formatter  =  await  cli . loadFormatter ( "unix" ) ; 
23+       const  actual  =  await  formatter . format ( lintResults ) ; 
24+       expect ( actual ) . toMatchSnapshot ( ) ; 
25+     } , 
26+     timeout 
27+   ) ; 
2028} 
2129
2230runTest ( "simple.ts" ) ; 
0 commit comments