()
| 347 | } |
| 348 | |
| 349 | async waitForTelemetryReady() { |
| 350 | // In sandbox mode, telemetry is written to a relative path in the test directory |
| 351 | const logFilePath = |
| 352 | env.ANUS_SANDBOX && env.ANUS_SANDBOX !== 'false' |
| 353 | ? join(this.testDir!, 'telemetry.log') |
| 354 | : env.TELEMETRY_LOG_FILE; |
| 355 | |
| 356 | if (!logFilePath) return; |
| 357 | |
| 358 | // Wait for telemetry file to exist and have content |
| 359 | await this.poll( |
| 360 | () => { |
| 361 | if (!fs.existsSync(logFilePath)) return false; |
| 362 | try { |
| 363 | const content = readFileSync(logFilePath, 'utf-8'); |
| 364 | // Check if file has meaningful content (at least one complete JSON object) |
| 365 | return content.includes('"event.name"'); |
| 366 | } catch { |
| 367 | return false; |
| 368 | } |
| 369 | }, |
| 370 | 2000, // 2 seconds max - reduced since telemetry should flush on exit now |
| 371 | 100, // check every 100ms |
| 372 | ); |
| 373 | } |
| 374 | |
| 375 | async waitForToolCall(toolName: string, timeout?: number) { |
| 376 | // Use environment-specific timeout |
no test coverage detected