Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

core: remove budgets #15950

Merged
merged 3 commits into from
Apr 17, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 1 addition & 6 deletions build/build-sample-reports.js
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ function addPluginCategory(sampleLhr) {
}

/**
* Drops the LHR to only one, solo category (performance), and removes budgets.
* Drops the LHR to only one, solo category (performance).
* @param {LH.Result} sampleLhr
*/
function tweakLhrForPsi(sampleLhr) {
Expand All @@ -128,11 +128,6 @@ function tweakLhrForPsi(sampleLhr) {
clone.categories = {
'performance': clone.categories.performance,
};
// no budgets in PSI
delete clone.audits['performance-budget'];
clone.categories.performance.auditRefs = clone.categories.performance.auditRefs.filter(audit => {
return !audit.id.endsWith('-budget');
});
return clone;
}

Expand Down

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

7 changes: 7 additions & 0 deletions build/test/page-functions-test-case-getNodeDetails-out.js.map

Large diffs are not rendered by default.

Large diffs are not rendered by default.

7 changes: 0 additions & 7 deletions cli/bin.js
Original file line number Diff line number Diff line change
Expand Up @@ -79,13 +79,6 @@ async function begin() {
config = (await import(`../core/config/${cliFlags.preset}-config.js`)).default;
}

if (cliFlags.budgetPath) {
cliFlags.budgetPath = path.resolve(process.cwd(), cliFlags.budgetPath);
/** @type {Array<LH.Budget>} */
const parsedBudget = JSON.parse(fs.readFileSync(cliFlags.budgetPath, 'utf8'));
cliFlags.budgets = parsedBudget;
}

// set logging preferences
cliFlags.logLevel = 'info';
if (cliFlags.verbose) {
Expand Down
6 changes: 1 addition & 5 deletions cli/cli-flags.js
Original file line number Diff line number Diff line change
Expand Up @@ -196,10 +196,6 @@ function getYargsParser(manualArgv) {
coerce: splitCommaSeparatedValues,
describe: 'Run everything except these audits',
},
'budget-path': {
type: 'string',
describe: 'The path to the budget.json file for LightWallet.',
},
'disable-full-page-screenshot': {
type: 'boolean',
describe: 'Disables collection of the full page screenshot, which can be quite large',
Expand All @@ -213,7 +209,7 @@ function getYargsParser(manualArgv) {
'save-assets', 'list-all-audits', 'list-locales', 'list-trace-categories', 'additional-trace-categories',
'config-path', 'preset', 'chrome-flags', 'port', 'hostname', 'form-factor', 'screenEmulation', 'emulatedUserAgent',
'max-wait-for-load', 'enable-error-reporting', 'gather-mode', 'audit-mode',
'only-audits', 'only-categories', 'skip-audits', 'budget-path', 'disable-full-page-screenshot', 'ignore-status-code',
'only-audits', 'only-categories', 'skip-audits', 'disable-full-page-screenshot', 'ignore-status-code',
], 'Configuration:')

// Output
Expand Down
4 changes: 0 additions & 4 deletions cli/test/cli/__snapshots__/cli-flags-test.js.snap
Original file line number Diff line number Diff line change
Expand Up @@ -383,10 +383,6 @@ Object {
"_": Array [
"http://www.example.com",
],
"budget-path": "path/to/my/budget-from-config.json",
"budgetPath": "path/to/my/budget-from-config.json",
"budgets-path": "path/to/my/budget-from-command-line.json",
"budgetsPath": "path/to/my/budget-from-command-line.json",
"channel": "cli",
"chrome-flags": "--window-size 800,600",
"chrome-ignore-default-flags": false,
Expand Down
12 changes: 0 additions & 12 deletions cli/test/cli/bin-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
* SPDX-License-Identifier: Apache-2.0
*/

import fs from 'fs';
import {pathToFileURL} from 'url';

import * as td from 'testdouble';
Expand Down Expand Up @@ -114,17 +113,6 @@ describe('CLI bin', function() {
});
});

describe('budget', () => {
it('should load the config from the path', async () => {
const budgetPath = `${LH_ROOT}/core/test/fixtures/simple-budget.json`;
cliFlags = {...cliFlags, budgetPath};
const budgetFile = JSON.parse(fs.readFileSync(budgetPath, 'utf-8'));
await bin.begin();

expect(getRunLighthouseArgs()[1].budgets).toEqual(budgetFile);
});
});

describe('logging', () => {
it('should have info by default', async () => {
await bin.begin();
Expand Down
13 changes: 0 additions & 13 deletions cli/test/cli/cli-flags-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -56,11 +56,9 @@ describe('CLI flags', function() {
const flags = getFlags([
'http://www.example.com',
`--cli-flags-path="${LH_ROOT}/cli/test/fixtures/cli-flags-path.json"`,
'--budgets-path=path/to/my/budget-from-command-line.json', // this should override the config value
].join(' '));

expect(flags).toMatchObject({
budgetsPath: 'path/to/my/budget-from-command-line.json',
onlyCategories: ['performance', 'seo'],
chromeFlags: '--window-size 800,600',
extraHeaders: {'X-Men': 'wolverine'},
Expand All @@ -73,17 +71,6 @@ describe('CLI flags', function() {
snapshot(flags);
});

it('settings are accepted from a file path (inlined budgets)', () => {
const flags = getFlags([
'http://www.example.com',
// eslint-disable-next-line max-len
`--cli-flags-path="${LH_ROOT}/cli/test/fixtures/cli-flags-path-inline-budgets.json"`,
].join(' '));

expect(flags.budgets).toMatchObject([{'anything': 'works'}]);
snapshot(flags);
});

it('array values support csv when appropriate', () => {
const flags = getFlags([
'http://www.example.com',
Expand Down
3 changes: 0 additions & 3 deletions cli/test/fixtures/cli-flags-path-inline-budgets.json

This file was deleted.

1 change: 0 additions & 1 deletion cli/test/fixtures/cli-flags-path.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
{
"budgetPath": "path/to/my/budget-from-config.json",
"onlyCategories": ["performance", "seo"],
"chromeFlags": "--window-size 800,600",
"extraHeaders": {"X-Men": "wolverine"},
Expand Down
2 changes: 0 additions & 2 deletions cli/test/smokehouse/core-tests.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@ import metricsTrickyTti from './test-definitions/metrics-tricky-tti.js';
import metricsTrickyTtiLateFcp from './test-definitions/metrics-tricky-tti-late-fcp.js';
import oopifRequests from './test-definitions/oopif-requests.js';
import oopifScripts from './test-definitions/oopif-scripts.js';
import perfBudgets from './test-definitions/perf-budgets.js';
import perfDebug from './test-definitions/perf-debug.js';
import perfDiagnosticsAnimations from './test-definitions/perf-diagnostics-animations.js';
import perfDiagnosticsThirdParty from './test-definitions/perf-diagnostics-third-party.js';
Expand Down Expand Up @@ -92,7 +91,6 @@ const smokeTests = [
metricsTrickyTtiLateFcp,
oopifRequests,
oopifScripts,
perfBudgets,
perfDebug,
perfDiagnosticsAnimations,
perfDiagnosticsThirdParty,
Expand Down
147 changes: 0 additions & 147 deletions cli/test/smokehouse/test-definitions/perf-budgets.js

This file was deleted.

33 changes: 0 additions & 33 deletions cli/test/smokehouse/test-definitions/perf-fonts.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,39 +16,6 @@ const config = {
// BF cache will request the page again, initiating additional network requests.
// Disable the audit so we only detect requests from the normal page load.
skipAudits: ['bf-cache'],

// A mixture of under, over, and meeting budget to exercise all paths.
budgets: [{
path: '/',
resourceCounts: [
{resourceType: 'total', budget: 8},
{resourceType: 'stylesheet', budget: 1}, // meets budget
{resourceType: 'image', budget: 1},
{resourceType: 'media', budget: 0},
{resourceType: 'font', budget: 2}, // meets budget
{resourceType: 'script', budget: 1},
{resourceType: 'document', budget: 0},
{resourceType: 'other', budget: 1},
{resourceType: 'third-party', budget: 0},
],
resourceSizes: [
{resourceType: 'total', budget: 100},
{resourceType: 'stylesheet', budget: 0},
{resourceType: 'image', budget: 30}, // meets budget
{resourceType: 'media', budget: 0},
{resourceType: 'font', budget: 75},
{resourceType: 'script', budget: 30},
{resourceType: 'document', budget: 1},
{resourceType: 'other', budget: 2}, // meets budget
{resourceType: 'third-party', budget: 0},
],
timings: [
{metric: 'first-contentful-paint', budget: 2000},
{metric: 'interactive', budget: 2000},
{metric: 'first-meaningful-paint', budget: 2000},
{metric: 'max-potential-fid', budget: 2000},
],
}],
},
};

Expand Down
33 changes: 0 additions & 33 deletions cli/test/smokehouse/test-definitions/perf-frame-metrics.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,39 +16,6 @@ const config = {
// BF cache will request the page again, initiating additional network requests.
// Disable the audit so we only detect requests from the normal page load.
skipAudits: ['bf-cache'],

// A mixture of under, over, and meeting budget to exercise all paths.
budgets: [{
path: '/',
resourceCounts: [
{resourceType: 'total', budget: 8},
{resourceType: 'stylesheet', budget: 1}, // meets budget
{resourceType: 'image', budget: 1},
{resourceType: 'media', budget: 0},
{resourceType: 'font', budget: 2}, // meets budget
{resourceType: 'script', budget: 1},
{resourceType: 'document', budget: 0},
{resourceType: 'other', budget: 1},
{resourceType: 'third-party', budget: 0},
],
resourceSizes: [
{resourceType: 'total', budget: 100},
{resourceType: 'stylesheet', budget: 0},
{resourceType: 'image', budget: 30}, // meets budget
{resourceType: 'media', budget: 0},
{resourceType: 'font', budget: 75},
{resourceType: 'script', budget: 30},
{resourceType: 'document', budget: 1},
{resourceType: 'other', budget: 2}, // meets budget
{resourceType: 'third-party', budget: 0},
],
timings: [
{metric: 'first-contentful-paint', budget: 2000},
{metric: 'interactive', budget: 2000},
{metric: 'first-meaningful-paint', budget: 2000},
{metric: 'max-potential-fid', budget: 2000},
],
}],
},
};

Expand Down
Loading
Loading