@@ -27,13 +27,11 @@ export async function run() {
2727
2828 globalThis . api = api
2929
30- // Configure Mocha with grep pattern if provided
3130 const mochaOptions : Mocha . MochaOptions = {
3231 ui : "tdd" ,
33- timeout : 300_000 ,
32+ timeout : 20 * 60 * 1_000 , // 20m
3433 }
3534
36- // Apply grep filter if TEST_GREP is set
3735 if ( process . env . TEST_GREP ) {
3836 mochaOptions . grep = process . env . TEST_GREP
3937 console . log ( `Running tests matching pattern: ${ process . env . TEST_GREP } ` )
@@ -42,17 +40,16 @@ export async function run() {
4240 const mocha = new Mocha ( mochaOptions )
4341 const cwd = path . resolve ( __dirname , ".." )
4442
45- // Get test files based on filter
4643 let testFiles : string [ ]
44+
4745 if ( process . env . TEST_FILE ) {
48- // Run specific test file
4946 const specificFile = process . env . TEST_FILE . endsWith ( ".js" )
5047 ? process . env . TEST_FILE
5148 : `${ process . env . TEST_FILE } .js`
49+
5250 testFiles = await glob ( `**/${ specificFile } ` , { cwd } )
5351 console . log ( `Running specific test file: ${ specificFile } ` )
5452 } else {
55- // Run all test files
5653 testFiles = await glob ( "**/**.test.js" , { cwd } )
5754 }
5855
@@ -62,7 +59,6 @@ export async function run() {
6259
6360 testFiles . forEach ( ( testFile ) => mocha . addFile ( path . resolve ( cwd , testFile ) ) )
6461
65- // Let's go!
6662 return new Promise < void > ( ( resolve , reject ) =>
6763 mocha . run ( ( failures ) => ( failures === 0 ? resolve ( ) : reject ( new Error ( `${ failures } tests failed.` ) ) ) ) ,
6864 )
0 commit comments