MCPcopy Index your code
hub / github.com/codeceptjs/CodeceptJS / writeIndex

Function writeIndex

lib/plugin/screenshot.js:425–438  ·  view source on GitHub ↗
(reportDir, recordedTests)

Source from the content-addressed store, hash-verified

423}
424
425function 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
440function escapeHtml(s) {
441 return String(s).replace(/[&<>"']/g, c => ({ '&': '&amp;', '<': '&lt;', '>': '&gt;', '"': '&quot;', "'": '&#39;' }[c]))

Callers 1

wireSlidesFunction · 0.85

Calls 4

templateFunction · 0.90
escapeHtmlFunction · 0.85
entriesMethod · 0.80
toStringMethod · 0.45

Tested by

no test coverage detected