When you run the script cumulative-layout-shift.js and largest-contentful-paint.js you get an error.
➜ node largest-contentful-paint.js
TypeError: Cannot read property 'viewport' of undefined
at Page.emulate (/Users/joan.leon/projects/PerfReviews/.../puppeteer-webperf/node_modules/puppeteer/lib/Page.js:541:38)
at Page.<anonymous> (/Users/joan.leon/projects/PerfReviews/.../puppeteer-webperf/node_modules/puppeteer/lib/helper.js:95:27)
at getLCP (/Users/joan.leon/projects/PerfReviews/.../puppeteer-webperf/largest-contentful-paint.js:55:16)
at processTicksAndRejections (internal/process/task_queues.js:93:5)
LCP is: undefined
This error is because the DeviceDescriptors export the devices inside devicesMap object.
In this Pull Request
Problem
When you run the script
cumulative-layout-shift.js
andlargest-contentful-paint.js
you get an error.This error is because the
DeviceDescriptors
export the devices insidedevicesMap
object.Solution
Add the key
devicesMap
to get devices, like: