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

Function scanRecordDirs

lib/plugin/screenshot.js:407–423  ·  view source on GitHub ↗
(reportDir)

Source from the content-addressed store, hash-verified

405}
406
407function scanRecordDirs(reportDir) {
408 const out = {}
409 try {
410 for (const item of fs.readdirSync(reportDir, { withFileTypes: true })) {
411 if (!item.isDirectory() || !item.name.startsWith('record_')) continue
412 const indexFile = path.join(reportDir, item.name, 'index.html')
413 if (!fs.existsSync(indexFile)) continue
414 const html = fs.readFileSync(indexFile, 'utf-8')
415 const titleMatch = html.match(/<title>([^<]*)<\/title>/)
416 const label = titleMatch ? titleMatch[1].replace(/^Slides — /, '') : item.name
417 out[label] = `${item.name}/index.html`
418 }
419 } catch (err) {
420 // ignore
421 }
422 return out
423}
424
425function writeIndex(reportDir, recordedTests) {
426 const items = Object.entries(recordedTests)

Callers 1

wireSlidesFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected