Files
gaokao-volunteer-system/apps/web/lighthouserc.cjs
Frontend Developer 61ba0ca987 Sprint 4 T-B-24 · Lighthouse CI (G3 闸门真实化)
- apps/web/lighthouserc.cjs: desktop preset, 3 runs, P/A/B/S ≥ 90 断言
- apps/web/scripts/lhci-scores.cjs: 本地汇总脚本(median P/A/B/S + / 标记)
- .github/workflows/web-ci.yml: 新增 lighthouse job,treosh/lighthouse-ci-action@v12
- apps/web/package.json: +lhci script
- apps/web/.gitignore: .lighthouseci/ 加入忽略(避免本地 12 个 run 报告污染 repo)

本地验证(desktop preset, 3 runs × 4 URLs):
  perf=100  a11y=95-96  best=96  seo=91  (全部 ≥ 90 )

G3 闸门状态:typecheck  / lint  / vitest 69  / e2e 84/84 
             / build 87.85KB  / Lighthouse P/A/B/S 
             / 真实后端 (T-B-27)/ Poster CLI Docker (T-C-44)
2026-07-04 10:08:10 +08:00

42 lines
1.3 KiB
JavaScript
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
/**
* V10 · Sprint 4 · T-B-24 · Lighthouse CI 配置
*
* G3 闸门真实化P/A/B/S 均 ≥ 90
* - perf: 性能首屏加载、TTI、TBT
* - a11y: 无障碍WCAG 2.1 AA
* - best-practices: HTTPS / CSP / console errors
* - seo: meta tags / viewport
*
* 注意mobile 测试(默认 form factor = mobile更严格
*/
module.exports = {
ci: {
collect: {
// 静态服务器从 vite preview 启动8081见 CI workflow
url: [
'http://127.0.0.1:8080/',
'http://127.0.0.1:8080/data-query',
'http://127.0.0.1:8080/plans',
'http://127.0.0.1:8080/about',
],
numberOfRuns: 3, // 取 P75median
settings: {
// P75 算分(默认 median = P50
preset: 'desktop',
chromeFlags: '--no-sandbox --headless=new',
},
},
assert: {
// G3 闸门:每类 ≥ 90
assertions: {
'categories:performance': ['error', { minScore: 0.9 }],
'categories:accessibility': ['error', { minScore: 0.9 }],
'categories:best-practices': ['error', { minScore: 0.9 }],
'categories:seo': ['error', { minScore: 0.9 }],
},
},
upload: {
target: 'temporary-public-storage', // 公开 storage 30 天;后续接 LHCI server
},
},
};