import type { UserConfig } from 'unlighthouse' export default async (): Promise<UserConfig> => { /* fetch sitemap from debug container */ const sitemap = await (await fetch('http://website:8081/sitemap-0.xml')).text(); /* format URLs to work with debug container */ const urls = sitemap.match(/<loc>(.*?)<\/loc>/g)!.map( (loc) => loc.replace(/<\/?loc>/g, '').replace(/https:\/\/firq.dev/g, 'http://website:8081') ); /* ensure serve is already "warm", preventing startup lag that reduces performance */ for (const url of urls) { await fetch(url) }; /* actual config */ return { lighthouseOptions: { throttlingMethod: 'simulate', throttling: { rttMs: 150, throughputKbps: 1638.4, requestLatencyMs: 562.5, // estimated latency at 150ms RTT downloadThroughputKbps: 1474.56, uploadThroughputKbps: 675, cpuSlowdownMultiplier: 4 }, screenEmulation: { mobile: true, width: 360, height: 640, deviceScaleFactor: 2.625, disabled: false }, skipAudits: [ 'is-on-https', 'redirects-http', 'uses-http2' ], }, puppeteerOptions: { args: [ '--no-sandbox', '--disable-setuid-sandbox' ], }, puppeteerClusterOptions: { maxConcurrency: 1 }, ci: { budget: 50, buildStatic: true, }, scanner: { sitemap: false, dynamicSampling: false, samples: 1, }, outputPath: 'unlighthouse-reports', cache: true, urls } }