-
Notifications
You must be signed in to change notification settings - Fork 7
Expand file tree
/
Copy path.lighthouserc.desktop.cjs
More file actions
50 lines (49 loc) · 2.11 KB
/
Copy path.lighthouserc.desktop.cjs
File metadata and controls
50 lines (49 loc) · 2.11 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
// QNBS-v3: Desktop Lighthouse config — runs alongside the mobile config (.lighthouserc.cjs).
// Serves production dist (pnpm run preview) and audits with desktop emulation.
// continue-on-error: true in ci.yml until desktop baselines stabilise.
// QNBS-v3: derive the audited URL from the same deploy-base logic the build/preview use
// (mirror of scripts/resolve-deploy-base.mjs — keep in sync). Hardcoding the GitHub Pages
// base made LHCI audit a 404 when the preview was built with VITE_BASE=/ or DEPLOY_TARGET=edge.
function resolveDeployBase() {
const viteBase = process.env.VITE_BASE?.trim();
if (viteBase) {
return viteBase.endsWith('/') ? viteBase : `${viteBase}/`;
}
if (process.env.DEPLOY_TARGET === 'edge') {
return '/';
}
return '/WorldScript-Studio/';
}
module.exports = {
ci: {
collect: {
startServerCommand: 'pnpm run preview',
startServerReadyPattern: 'Local',
url: [`http://127.0.0.1:4173${resolveDeployBase()}`],
numberOfRuns: 2,
settings: {
// QNBS-v3: same /dev/shm crash hardening as the mobile config (.lighthouserc.cjs) —
// --disable-dev-shm-usage prevents the "Execution context was destroyed" CI flake.
chromeFlags: '--no-sandbox --disable-dev-shm-usage --disable-gpu',
preset: 'desktop',
throttlingMethod: 'simulate',
},
},
assert: {
assertions: {
// QNBS-v3: Accessibility is an error gate on desktop too — mirrors mobile + axe-core E2E commitment.
'categories:accessibility': ['error', { minScore: 0.95 }],
// QNBS-v3: Desktop performance bar is higher than mobile (no throttling penalty).
'categories:performance': ['warn', { minScore: 0.7 }],
'categories:seo': ['warn', { minScore: 0.8 }],
'first-contentful-paint': ['warn', { maxNumericValue: 3000 }],
'largest-contentful-paint': ['warn', { maxNumericValue: 5000 }],
'total-blocking-time': ['warn', { maxNumericValue: 300 }],
'cumulative-layout-shift': ['error', { maxNumericValue: 0.1 }],
},
},
upload: {
target: 'temporary-public-storage',
},
},
};