(
rig: TestRig,
result: string,
context: Record<string, unknown> = {},
)
| 40 | |
| 41 | // Helper to print debug information when tests fail |
| 42 | export function printDebugInfo( |
| 43 | rig: TestRig, |
| 44 | result: string, |
| 45 | context: Record<string, unknown> = {}, |
| 46 | ) { |
| 47 | console.error('Test failed - Debug info:'); |
| 48 | console.error('Result length:', result.length); |
| 49 | console.error('Result (first 500 chars):', result.substring(0, 500)); |
| 50 | console.error( |
| 51 | 'Result (last 500 chars):', |
| 52 | result.substring(result.length - 500), |
| 53 | ); |
| 54 | |
| 55 | // Print any additional context provided |
| 56 | Object.entries(context).forEach(([key, value]) => { |
| 57 | console.error(`${key}:`, value); |
| 58 | }); |
| 59 | |
| 60 | // Check what tools were actually called |
| 61 | const allTools = rig.readToolLogs(); |
| 62 | console.error( |
| 63 | 'All tool calls found:', |
| 64 | allTools.map((t) => t.toolRequest.name), |
| 65 | ); |
| 66 | |
| 67 | return allTools; |
| 68 | } |
| 69 | |
| 70 | // Helper to validate model output and warn about unexpected content |
| 71 | export function validateModelOutput( |
no test coverage detected