(r)
| 393 | // Formats structured result as the tool's text output (the string the model sees). |
| 394 | |
| 395 | function formatResult(r) { |
| 396 | if (!r.command) return r.raw || 'No test runner found.'; |
| 397 | |
| 398 | const lines = []; |
| 399 | lines.push(`run_tests (${r.framework}): ${r.summary} [${Math.round(r.durationMs / 100) / 10}s]`); |
| 400 | lines.push(`command: ${r.command}`); |
| 401 | |
| 402 | if (r.failures.length > 0) { |
| 403 | lines.push(''); |
| 404 | lines.push('Failures:'); |
| 405 | for (const f of r.failures) { |
| 406 | lines.push(` ✗ ${f.name}${f.message ? ': ' + f.message : ''}`); |
| 407 | } |
| 408 | } |
| 409 | |
| 410 | if (r.raw) { |
| 411 | lines.push(''); |
| 412 | lines.push('--- raw output ---'); |
| 413 | lines.push(r.raw); |
| 414 | } |
| 415 | |
| 416 | return lines.join('\n'); |
| 417 | } |
| 418 | |
| 419 | module.exports = { |
| 420 | runTests, |
no outgoing calls
no test coverage detected