| 405 | } |
| 406 | |
| 407 | function 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 | |
| 425 | function writeIndex(reportDir, recordedTests) { |
| 426 | const items = Object.entries(recordedTests) |