How to use performance budgets with flow API #14276
Answered
by
adamraine
chatur-sriganesh
asked this question in
Q&A
-
Hi, Is there a way to use performance budgets/lightwallet with flow API? |
Beta Was this translation helpful? Give feedback.
Answered by
adamraine
Aug 10, 2022
Replies: 1 comment 1 reply
-
You can define budgets on the config: import * as flowApi from 'lighthouse/core/fraggle-rock/api.js';
import puppeteer from 'puppeteer';
import fs from 'fs';
const browser = await puppeteer.launch({headless: false});
const page = await browser.newPage()
const config = {
extends: 'lighthouse:default',
settings: {
budgets: [
{
path: '/*',
resourceSizes: [
{
resourceType: 'script',
budget: 200
}
]
}
]
}
}
const flow = await flowApi.startFlow(page, {config});
await flow.navigate('https://paulirish.com');
const report = await flow.generateReport();
fs.writeFileSync('flow.report.html', report);
await page.close();
await browser.close() Might be worth noting this in our docs though. |
Beta Was this translation helpful? Give feedback.
1 reply
Answer selected by
chatur-sriganesh
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
You can define budgets on the config: