Makes Lighthouse performance report-only in CI
Lighthouse slows the CPU 4x relative to the measuring machine, so the Raspberry Pi runner scores performance 30-40 points lower than a PC for the same build. In CI the performance assertions now only warn; accessibility, best practices and SEO still block, and performance still blocks in `pnpm check` on a PC. Mobile and desktop reports go to separate folders and are attached to every run as an artifact. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -26,3 +26,4 @@ dist-ssr
|
||||
# Testdekking en Lighthouse CI
|
||||
coverage
|
||||
.lighthouseci
|
||||
lighthouse-reports
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
|
||||
**/routeTree.gen.ts
|
||||
.lighthouseci
|
||||
lighthouse-reports
|
||||
coverage
|
||||
dist
|
||||
pnpm-lock.yaml
|
||||
|
||||
@@ -11,6 +11,7 @@ export default tseslint.config(
|
||||
'dist',
|
||||
'coverage',
|
||||
'.lighthouseci',
|
||||
'lighthouse-reports',
|
||||
'.agents',
|
||||
'.claude',
|
||||
'.junie',
|
||||
|
||||
+12
-4
@@ -21,8 +21,15 @@ const notFoundPath = '/bestaat-niet';
|
||||
// afbeeldingen uit de API/CMS en prerendering (NFR-P-01).
|
||||
const homeMobilePerformance = 0.8;
|
||||
|
||||
// Performance hangt af van de snelheid van de meetmachine: Lighthouse vertraagt
|
||||
// de CPU 4x ten opzichte van een snelle desktop. Op de CI-runner (Raspberry Pi)
|
||||
// valt de score daardoor 30-40 punten lager uit dan op een pc. In CI daarom
|
||||
// alleen melden (LIGHTHOUSE_PERFORMANCE=warn); lokaal in `pnpm check` blokkerend.
|
||||
const performanceLevel =
|
||||
process.env.LIGHTHOUSE_PERFORMANCE === 'warn' ? 'warn' : 'error';
|
||||
|
||||
const quality = {
|
||||
'categories:performance': ['error', { minScore: 0.9 }],
|
||||
'categories:performance': [performanceLevel, { minScore: 0.9 }],
|
||||
'categories:accessibility': ['error', { minScore: 1 }],
|
||||
'categories:best-practices': ['error', { minScore: 1 }],
|
||||
};
|
||||
@@ -40,6 +47,7 @@ const escape = (path) => path.replace(/[.*+?^${}()|[\]\\/]/g, '\\$&');
|
||||
const exact = (paths) => `^${origin}(${paths.map(escape).join('|')})$`;
|
||||
|
||||
module.exports = {
|
||||
performanceLevel,
|
||||
indexedPaths,
|
||||
noindexPaths,
|
||||
notFoundPath,
|
||||
@@ -66,7 +74,7 @@ module.exports = {
|
||||
assertions: {
|
||||
...quality,
|
||||
'categories:performance': [
|
||||
'error',
|
||||
performanceLevel,
|
||||
{ minScore: homeMobilePerformance },
|
||||
],
|
||||
'categories:seo': ['error', { minScore: 1 }],
|
||||
@@ -88,9 +96,9 @@ module.exports = {
|
||||
],
|
||||
},
|
||||
upload: {
|
||||
// Resultaten blijven lokaal in .lighthouseci/
|
||||
// HTML- en JSON-rapporten per meting; in CI als download bij de run
|
||||
target: 'filesystem',
|
||||
outputDir: '.lighthouseci',
|
||||
outputDir: 'lighthouse-reports/mobile',
|
||||
},
|
||||
},
|
||||
};
|
||||
|
||||
@@ -17,11 +17,18 @@ module.exports = {
|
||||
...home,
|
||||
assertions: {
|
||||
...home.assertions,
|
||||
'categories:performance': ['error', { minScore: 0.9 }],
|
||||
'categories:performance': [
|
||||
base.performanceLevel,
|
||||
{ minScore: 0.9 },
|
||||
],
|
||||
},
|
||||
},
|
||||
...rest,
|
||||
],
|
||||
},
|
||||
upload: {
|
||||
...base.ci.upload,
|
||||
outputDir: 'lighthouse-reports/desktop',
|
||||
},
|
||||
},
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user