// Lighthouse CI — budget di §9.3 del brief (preset mobile di Lighthouse, 3 run, mediana). // Chrome: si usa il Chromium installato da Playwright, così funziona anche nel container CI. const { chromium } = require('playwright'); module.exports = { ci: { collect: { staticDistDir: './dist', url: [ 'http://localhost/', 'http://localhost/servizi/', 'http://localhost/servizi/consulenza-fiscale-tributaria-e-societaria/', 'http://localhost/contatti/', ], numberOfRuns: 3, chromePath: chromium.executablePath(), settings: { chromeFlags: '--no-sandbox --headless=new --disable-dev-shm-usage --disable-gpu', }, }, assert: { preset: 'lighthouse:recommended', aggregationMethod: 'median-run', assertions: { // Soglie del brief §9.3: sono queste a bloccare la CI. 'categories:performance': ['error', { minScore: 0.95 }], 'categories:accessibility': ['error', { minScore: 1 }], 'categories:best-practices': ['error', { minScore: 0.95 }], 'categories:seo': ['error', { minScore: 1 }], // Audit informativi o dipendenti dal server di test, declassati ad avviso // (vedi DECISIONS.md). Restano visibili nei report. 'network-dependency-tree-insight': 'warn', // segnala qualsiasi catena HTML → font/JS 'critical-request-chains': 'warn', 'render-blocking-insight': 'warn', 'render-blocking-resources': 'warn', 'uses-http2': 'warn', // il server statico di LHCI usa HTTP/1.1 'bf-cache': 'warn', 'csp-xss': 'warn', // la CSP è un header del server (.htaccess), assente in LHCI }, }, upload: { // Nessun invio a servizi esterni: i report restano in locale. target: 'filesystem', outputDir: '.lighthouseci/reports', }, }, };