feat(cli): Add new timeout and file range options with enhanced logfile diff logging
This commit is contained in:
		
							
								
								
									
										17
									
								
								ts/index.ts
									
									
									
									
									
								
							
							
						
						
									
										17
									
								
								ts/index.ts
									
									
									
									
									
								
							| @@ -15,6 +15,7 @@ export const runCli = async () => { | ||||
|   let tags: string[] = []; | ||||
|   let startFromFile: number | null = null; | ||||
|   let stopAtFile: number | null = null; | ||||
|   let timeoutSeconds: number | null = null; | ||||
|    | ||||
|   // Parse options | ||||
|   for (let i = 0; i < args.length; i++) { | ||||
| @@ -70,6 +71,19 @@ export const runCli = async () => { | ||||
|           process.exit(1); | ||||
|         } | ||||
|         break; | ||||
|       case '--timeout': | ||||
|         if (i + 1 < args.length) { | ||||
|           const value = parseInt(args[++i], 10); | ||||
|           if (isNaN(value) || value < 1) { | ||||
|             console.error('Error: --timeout must be a positive integer (seconds)'); | ||||
|             process.exit(1); | ||||
|           } | ||||
|           timeoutSeconds = value; | ||||
|         } else { | ||||
|           console.error('Error: --timeout requires a number argument (seconds)'); | ||||
|           process.exit(1); | ||||
|         } | ||||
|         break; | ||||
|       default: | ||||
|         if (!arg.startsWith('-')) { | ||||
|           testPath = arg; | ||||
| @@ -95,6 +109,7 @@ export const runCli = async () => { | ||||
|     console.error('  --tags <tags>     Run only tests with specified tags (comma-separated)'); | ||||
|     console.error('  --startFrom <n>   Start running from test file number n'); | ||||
|     console.error('  --stopAt <n>      Stop running at test file number n'); | ||||
|     console.error('  --timeout <s>     Timeout test files after s seconds'); | ||||
|     process.exit(1); | ||||
|   } | ||||
|    | ||||
| @@ -109,7 +124,7 @@ export const runCli = async () => { | ||||
|     executionMode = TestExecutionMode.DIRECTORY; | ||||
|   } | ||||
|    | ||||
|   const tsTestInstance = new TsTest(process.cwd(), testPath, executionMode, logOptions, tags, startFromFile, stopAtFile); | ||||
|   const tsTestInstance = new TsTest(process.cwd(), testPath, executionMode, logOptions, tags, startFromFile, stopAtFile, timeoutSeconds); | ||||
|   await tsTestInstance.run(); | ||||
| }; | ||||
|  | ||||
|   | ||||
		Reference in New Issue
	
	Block a user