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: move preload audits to experimental config #15876

Merged
merged 3 commits into from
Mar 21, 2024
Merged
Show file tree
Hide file tree
Changes from 2 commits
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
24 changes: 12 additions & 12 deletions cli/test/smokehouse/test-definitions/perf-fonts.js
Original file line number Diff line number Diff line change
Expand Up @@ -76,18 +76,18 @@ const expectations = {
],
},
},
'preload-fonts': {
scoreDisplayMode: 'notApplicable',
// Disabled for now, see https://github.com/GoogleChrome/lighthouse/issues/11960
// score: 0,
// details: {
// items: [
// {
// url: 'http://localhost:10200/perf/lobster-two-v10-latin-700.woff2?delay=1000',
// },
// ],
// },
},
// Disabled for now, see https://github.com/GoogleChrome/lighthouse/issues/11960
// 'preload-fonts': {
// scoreDisplayMode: 'notApplicable',
// score: 0,
// details: {
// items: [
// {
// url: 'http://localhost:10200/perf/lobster-two-v10-latin-700.woff2?delay=1000',
// },
// ],
// },
// },
},
},
};
Expand Down
30 changes: 15 additions & 15 deletions cli/test/smokehouse/test-definitions/perf-preload.js
Original file line number Diff line number Diff line change
Expand Up @@ -107,21 +107,21 @@ const expectations = {
},
},
},
'uses-rel-preload': {
scoreDisplayMode: 'notApplicable',
// Disabled for now, see https://github.com/GoogleChrome/lighthouse/issues/11960
// score: '<1',
// numericValue: '>500',
// warnings: {
// 0: /level-2.*warning/,
// length: 1,
// },
// details: {
// items: {
// length: 1,
// },
// },
},
// Disabled for now, see https://github.com/GoogleChrome/lighthouse/issues/11960
// 'uses-rel-preload': {
// scoreDisplayMode: 'notApplicable',
// score: '<1',
// numericValue: '>500',
// warnings: {
// 0: /level-2.*warning/,
// length: 1,
// },
// details: {
// items: {
// length: 1,
// },
// },
// },
'uses-rel-preconnect': {
score: 1,
warnings: [/localhost:10503/],
Expand Down
11 changes: 1 addition & 10 deletions core/audits/preload-fonts.js
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ class PreloadFontsAudit extends Audit {
* @param {LH.Audit.Context} context
* @return {Promise<LH.Audit.Product>}
*/
static async audit_(artifacts, context) {
static async audit(artifacts, context) {
const devtoolsLog = artifacts.devtoolsLogs[this.DEFAULT_PASS];
const networkRecords = await NetworkRecords.request(devtoolsLog, context);

Expand Down Expand Up @@ -91,15 +91,6 @@ class PreloadFontsAudit extends Audit {
notApplicable: optionalFontURLs.size === 0,
};
}

/**
* @return {Promise<LH.Audit.Product>}
*/
static async audit() {
// Preload advice is on hold until https://github.com/GoogleChrome/lighthouse/issues/11960
// is resolved.
return {score: 1, notApplicable: true};
}
}

export default PreloadFontsAudit;
Expand Down
12 changes: 1 addition & 11 deletions core/audits/uses-rel-preload.js
Original file line number Diff line number Diff line change
Expand Up @@ -209,7 +209,7 @@ class UsesRelPreloadAudit extends Audit {
* @param {LH.Audit.Context} context
* @return {Promise<LH.Audit.Product>}
*/
static async audit_(artifacts, context) {
static async audit(artifacts, context) {
const trace = artifacts.traces[UsesRelPreloadAudit.DEFAULT_PASS];
const devtoolsLog = artifacts.devtoolsLogs[UsesRelPreloadAudit.DEFAULT_PASS];
const URL = artifacts.URL;
Expand Down Expand Up @@ -253,16 +253,6 @@ class UsesRelPreloadAudit extends Audit {
warnings,
};
}

/**
* @return {Promise<LH.Audit.Product>}
*/
static async audit() {
// Preload advice is on hold until https://github.com/GoogleChrome/lighthouse/issues/11960
// is resolved.
return {score: 1, notApplicable: true,
details: Audit.makeOpportunityDetails([], [], {overallSavingsMs: 0})};
}
}

export default UsesRelPreloadAudit;
Expand Down
4 changes: 0 additions & 4 deletions core/config/default-config.js
Original file line number Diff line number Diff line change
Expand Up @@ -201,12 +201,10 @@ const defaultConfig = {
'content-width',
'image-aspect-ratio',
'image-size-responsive',
'preload-fonts',
'deprecations',
'third-party-cookies',
'mainthread-work-breakdown',
'bootup-time',
'uses-rel-preload',
'uses-rel-preconnect',
'font-display',
'diagnostics',
Expand Down Expand Up @@ -460,7 +458,6 @@ const defaultConfig = {
{id: 'uses-rel-preconnect', weight: 0},
{id: 'server-response-time', weight: 0},
{id: 'redirects', weight: 0},
{id: 'uses-rel-preload', weight: 0},
{id: 'uses-http2', weight: 0},
{id: 'efficient-animated-content', weight: 0},
{id: 'duplicated-javascript', weight: 0},
Expand Down Expand Up @@ -605,7 +602,6 @@ const defaultConfig = {
{id: 'paste-preventing-inputs', weight: 3, group: 'best-practices-ux'},
{id: 'image-aspect-ratio', weight: 1, group: 'best-practices-ux'},
{id: 'image-size-responsive', weight: 1, group: 'best-practices-ux'},
{id: 'preload-fonts', weight: 1, group: 'best-practices-ux'},
// Browser Compatibility
{id: 'doctype', weight: 1, group: 'best-practices-browser-compat'},
{id: 'charset', weight: 1, group: 'best-practices-browser-compat'},
Expand Down
11 changes: 11 additions & 0 deletions core/config/experimental-config.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,24 @@ const config = {
extends: 'lighthouse:default',
audits: [
'autocomplete',
// Preload advice is on hold until https://github.com/GoogleChrome/lighthouse/issues/11960
'preload-fonts',
'uses-rel-preload',
],
categories: {
// @ts-ignore: `title` is required in CategoryJson. setting to the same value as the default
// config is awkward - easier to omit the property here. Will defer to default config.
'performance': {
auditRefs: [
{id: 'uses-rel-preload', weight: 0},
],
},
// @ts-ignore: `title` is required in CategoryJson. setting to the same value as the default
// config is awkward - easier to omit the property here. Will defer to default config.
'best-practices': {
auditRefs: [
{id: 'autocomplete', weight: 0, group: 'best-practices-ux'},
{id: 'preload-fonts', weight: 0, group: 'best-practices-ux'},
],
},
},
Expand Down
2 changes: 0 additions & 2 deletions core/config/metrics-to-audits.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ const fcpRelevantAudits = [
'critical-request-chains',
'uses-text-compression',
'uses-rel-preconnect',
'uses-rel-preload',
'font-display',
'unminified-javascript',
'unminified-css',
Expand Down Expand Up @@ -46,7 +45,6 @@ const clsRelevantAudits = [
'layout-shifts',
'non-composited-animations',
'unsized-images',
// 'preload-fonts', // actually in BP, rather than perf
];

const inpRelevantAudits = [
Expand Down
12 changes: 6 additions & 6 deletions core/test/audits/preload-fonts-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ describe('Preload Fonts Audit', () => {
},
];

const result = await PreloadFontsAudit.audit_(getArtifacts(), context);
const result = await PreloadFontsAudit.audit(getArtifacts(), context);
expect(result.score).toEqual(0);
expect(result.details.items).toEqual([
{url: networkRecords[0].url},
Expand All @@ -65,7 +65,7 @@ describe('Preload Fonts Audit', () => {
},
];

const result = await PreloadFontsAudit.audit_(getArtifacts(), context);
const result = await PreloadFontsAudit.audit(getArtifacts(), context);
expect(result.details.items).toEqual([]);
expect(result.score).toEqual(1);
});
Expand All @@ -87,7 +87,7 @@ describe('Preload Fonts Audit', () => {
},
];

const result = await PreloadFontsAudit.audit_(getArtifacts(), context);
const result = await PreloadFontsAudit.audit(getArtifacts(), context);
expect(result.score).toEqual(1);
expect(result.details.items).toEqual([]);
expect(result.notApplicable).toEqual(true);
Expand All @@ -108,7 +108,7 @@ describe('Preload Fonts Audit', () => {
},
];

const result = await PreloadFontsAudit.audit_(getArtifacts(), context);
const result = await PreloadFontsAudit.audit(getArtifacts(), context);
expect(result.score).toEqual(1);
expect(result.details.items).toEqual([]);
expect(result.notApplicable).toEqual(true);
Expand Down Expand Up @@ -139,7 +139,7 @@ describe('Preload Fonts Audit', () => {

networkRecords = [];

const result = await PreloadFontsAudit.audit_(getArtifacts(), context);
const result = await PreloadFontsAudit.audit(getArtifacts(), context);
expect(result.score).toEqual(1);
expect(result.details.items).toEqual([]);
expect(result.notApplicable).toEqual(true);
Expand Down Expand Up @@ -191,7 +191,7 @@ describe('Preload Fonts Audit', () => {
},
];

const result = await PreloadFontsAudit.audit_(getArtifacts(), context);
const result = await PreloadFontsAudit.audit(getArtifacts(), context);
expect(result.score).toEqual(0);
expect(result.details.items).toEqual([
{url: networkRecords[1].url},
Expand Down
Loading
Loading