fix(plugins/pagespeed): add placeholder for PWA (#1113) [skip ci]

This commit is contained in:
Jayant Goel
2022-06-27 02:41:05 +05:30
committed by GitHub
parent c07912eebb
commit 005a9d633d
2 changed files with 3 additions and 2 deletions

View File

@@ -331,8 +331,8 @@ export async function imgb64(image, {width, height, fallback = true} = {}) {
return fallback ? "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAADUlEQVR42mOcOnfpfwAGfgLYttYINwAAAABJRU5ErkJggg==" : null
//Load image
try {
//Fix: redirections are not properly supported by jimp (https://github.com/oliver-moran/jimp/issues/909)
if (typeof image === "string") {
//Fix: redirections are not properly supported by jimp (https://github.com/oliver-moran/jimp/issues/909), seems to occur only when in jest environment
if ((typeof image === "string")&&(process.env.JEST_WORKER_ID)) {
image = (await axios.get(image)).then(response => response.request.responseURL).catch(() => null)
console.debug(`metrics/svg/imgb64 > redirected image link to ${image}`)
}

View File

@@ -653,6 +653,7 @@
{score: faker.datatype.float({max: 1}), title: "Accessibility"},
{score: faker.datatype.float({max: 1}), title: "Best Practices"},
{score: faker.datatype.float({max: 1}), title: "SEO"},
... options["pagespeed.pwa"] ? [{score : faker.datatype.number({max: 1}), title: "PWA"}] : []
],
metrics: {
observedFirstContentfulPaint: faker.datatype.number(500),