test: fix the perf lane's resource typing for typecheck

getEntriesByType widens to PerformanceEntry; transferSize/
decodedBodySize live on PerformanceResourceTiming (the e2e specs sit
outside tsconfig.build.json, so the bundler never saw this).
This commit is contained in:
Menghuan1918
2026-09-01 16:07:33 +08:00
parent 8a01e5d881
commit e06ce8cef1
+9 -6
View File
@@ -149,12 +149,15 @@ test('measure: mount latency, longtasks and bundle cost through a full tab sweep
const resources = await page.evaluate(() => const resources = await page.evaluate(() =>
performance.getEntriesByType('resource') performance.getEntriesByType('resource')
.filter(entry => /sidebar/.test(entry.name)) .filter(entry => /sidebar/.test(entry.name))
.map(entry => ({ .map(entry => {
name: entry.name.replace(/^https?:\/\/[^/]+/, ''), const resource = entry as PerformanceResourceTiming
transferSize: entry.transferSize, return {
decodedBodySize: entry.decodedBodySize, name: entry.name.replace(/^https?:\/\/[^/]+/, ''),
duration: entry.duration, transferSize: resource.transferSize,
})) as ResourceStat[], decodedBodySize: resource.decodedBodySize,
duration: entry.duration,
}
}) as ResourceStat[],
) )
const longtasks = probe.longtasks ?? [] const longtasks = probe.longtasks ?? []