({ dir, title, file, durationMs, commands, captured, error })
| 69 | } |
| 70 | |
| 71 | export function writeTraceMarkdown({ dir, title, file, durationMs, commands, captured, error }) { |
| 72 | let md = `file: ${file || 'mcp'}\n` |
| 73 | md += `name: ${title}\n` |
| 74 | md += `time: ${(durationMs / 1000).toFixed(2)}s\n` |
| 75 | md += `---\n\n` |
| 76 | |
| 77 | if (error) md += `Error: ${error}\n\n---\n\n` |
| 78 | |
| 79 | if (commands && commands.length) { |
| 80 | md += `### Commands\n` |
| 81 | for (const c of commands) md += `- ${c}\n` |
| 82 | md += `\n` |
| 83 | } |
| 84 | |
| 85 | md += `### Final State\n` |
| 86 | if (captured.url) md += ` > URL: ${captured.url}\n` |
| 87 | const links = artifactLinks(captured) |
| 88 | if (links) md += links + '\n' |
| 89 | |
| 90 | const traceFile = path.join(dir, 'trace.md') |
| 91 | fs.writeFileSync(traceFile, md) |
| 92 | return traceFile |
| 93 | } |
| 94 | |
| 95 | export function artifactsToFileUrls(captured, dir) { |
| 96 | const out = {} |
no test coverage detected