(reportDir, recordedTests)
| 423 | } |
| 424 | |
| 425 | function writeIndex(reportDir, recordedTests) { |
| 426 | const items = Object.entries(recordedTests) |
| 427 | .map(([name, href]) => `<li><a href="${href}">${escapeHtml(name)}</a></li>`) |
| 428 | .join('\n') |
| 429 | |
| 430 | const html = template(INDEX_TEMPLATE, { |
| 431 | time: new Date().toString(), |
| 432 | records: items, |
| 433 | }) |
| 434 | |
| 435 | const indexPath = path.join(reportDir, 'records.html') |
| 436 | fs.writeFileSync(indexPath, html) |
| 437 | output.print(`Step-by-step preview: file://${indexPath}`) |
| 438 | } |
| 439 | |
| 440 | function escapeHtml(s) { |
| 441 | return String(s).replace(/[&<>"']/g, c => ({ '&': '&', '<': '<', '>': '>', '"': '"', "'": ''' }[c])) |
no test coverage detected