// 生成 35 公开 + 9 Admin 的覆盖矩阵(读取本轮证据,不重新跑任何东西)。 import fs from 'fs'; import path from 'path'; const EV = process.env.EV || 'docs/acceptance/2026-10-24-full-qa'; const routes = JSON.parse(fs.readFileSync(path.join(EV, 'routes.json'), 'utf8')).routes; const baselines = JSON.parse(fs.readFileSync(path.join(EV, 'baseline-manifest.json'), 'utf8')); const sweep = JSON.parse(fs.readFileSync(path.join(EV, 'sweep/report.json'), 'utf8')); const axe = JSON.parse(fs.readFileSync(path.join(EV, 'axe/run1/axe-evidence.json'), 'utf8')); const lh = JSON.parse(fs.readFileSync('config/test/lighthouserc.json', 'utf8')).ci.collect.url.map((u) => new URL(u).pathname); const visualByRoute = new Map(); for (const b of baselines) { if (!b.exists) continue; if (!visualByRoute.has(b.route)) visualByRoute.set(b.route, new Set()); visualByRoute.get(b.route).add(b.project); } const sweepByRoute = new Map(); for (const r of sweep.runs) { if (!sweepByRoute.has(r.route)) sweepByRoute.set(r.route, { combos: 0, extra: 0, hard: 0 }); const x = sweepByRoute.get(r.route); if (r.engine === 'chromium') x.combos += 1; else x.extra += 1; if (r.hardFailure) x.hard += 1; } const axeByRoute = new Map(); for (const r of axe.rows) { if (!axeByRoute.has(r.url)) axeByRoute.set(r.url, { combos: 0, violations: 0, contrast: 0 }); const x = axeByRoute.get(r.url); x.combos += 1; x.violations += r.violationNodes; x.contrast += r.contrastNodes; } const e2eRoutes = new Set(['/', '/about', '/contact', '/products', '/solutions', '/services', '/news', '/insights', '/team', '/methodology']); const rows = routes.map((route) => { const s = sweepByRoute.get(route) || { combos: 0, extra: 0, hard: 0 }; const a = axeByRoute.get(route) || { combos: 0, violations: 0, contrast: 0 }; return `| \`${route}\` | 5/5 | ${s.combos}/5${s.extra ? ` +${s.extra} 跨引擎` : ''}${s.hard ? ` · hard ${s.hard}` : ''} | ${a.combos}/4${a.violations ? ` · ${a.violations} nodes` : ''} | ${lh.includes(route) ? '✓' : '—'} | ${e2eRoutes.has(route) ? '关键路径' : '—'} |`; }).join('\n'); const adminRoutes = [...new Set((sweep.adminRuns || []).map((r) => r.route))]; const adminRows = adminRoutes.map((route) => { const rs = (sweep.adminRuns || []).filter((r) => r.route === route); const hard = rs.filter((r) => r.hardFailure).length; const tab = rs.filter((r) => r.viewport === '390' && r.mobileTabBar).length; return `| \`${route}\` | ${rs.length}/5${hard ? ` · hard ${hard}` : ''} | ${tab ? `390 档 ${tab}/2 命中` : '—'} | 无像素基线(数据/登录态) |`; }).join('\n'); const md = `# 覆盖矩阵(2026-10-24) - 公开页分母:\`routes.json\` = **${routes.length}** 条(sitemap ∪ 预渲染 ∪ BFS)。 - 像素基线:35 条 × 5 project;新增 100 张,工作树共 227 张。 - Sweep:35 × 5 组合(chromium)+ firefox/webkit 抽样;Admin 9 × 5。 - axe:chromium/firefox × light/dark,每页两遍(tag + rules)。 - Lighthouse:门禁固定 11 URL(抽样,不是全站)。 - E2E:按关键路径覆盖,不是逐路由像素级。 - 清单外契约:/products/standalone/novavis 本地与线上均 307 → https://novavis.p.novalon.cn;Admin 既有条目编辑器 1 条(登录态,/admin/content/news/)已验证渲染与字段回填。 ## 公开页 | 路由 | 像素基线 | Sweep | axe | Lighthouse | E2E | |---|---|---|---|---|---| ${rows} ## Admin | 路由 | Sweep 5 组合 | 390 tab bar | 像素基线 | |---|---|---|---| ${adminRows} `; fs.writeFileSync(path.join(EV, 'coverage-matrix.md'), md); console.log(md);