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

feat: upgrade to lighthouse 11.4.0 #991

Merged
merged 5 commits into from
Dec 15, 2023
Merged
Show file tree
Hide file tree
Changes from all 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
2 changes: 1 addition & 1 deletion packages/cli/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
"https-proxy-agent": "^5.0.0",
"inquirer": "^6.3.1",
"isomorphic-fetch": "^3.0.0",
"lighthouse": "10.1.0",
"lighthouse": "11.4.0",
"lighthouse-logger": "1.2.0",
"open": "^7.1.0",
"tmp": "^0.1.0",
Expand Down
6 changes: 3 additions & 3 deletions packages/cli/test/assert.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ describe('Lighthouse CI assert CLI', () => {
it('should run the recommended preset', async () => {
const result = await run([`--preset=lighthouse:recommended`]);
expect(result.status).toEqual(1);
expect(result.failures.length).toMatchInlineSnapshot(`98`);
expect(result.failures.length).toMatchInlineSnapshot(`115`);
expect(result.warnings.length).toMatchInlineSnapshot(`17`);
expect(result.passes.length).toMatchInlineSnapshot(`0`);
expect(result.failures).toContain('deprecations failure');
Expand All @@ -65,7 +65,7 @@ describe('Lighthouse CI assert CLI', () => {
it('should run the no-pwa preset', async () => {
const result = await run([`--preset=lighthouse:no-pwa`]);
expect(result.status).toEqual(1);
expect(result.failures.length).toMatchInlineSnapshot(`91`);
expect(result.failures.length).toMatchInlineSnapshot(`109`);
expect(result.warnings.length).toMatchInlineSnapshot(`16`);
expect(result.passes.length).toMatchInlineSnapshot(`0`);
expect(result.failures).toContain('deprecations failure');
Expand All @@ -92,7 +92,7 @@ describe('Lighthouse CI assert CLI', () => {
const result = await run([`--preset=lighthouse:recommended`, '--include-passed-assertions']);
expect(result.status).toEqual(1);
expect(result.warnings.length).toMatchInlineSnapshot(`17`);
expect(result.failures.length).toMatchInlineSnapshot(`98`);
expect(result.failures.length).toMatchInlineSnapshot(`115`);
expect(result.passes.length).toMatchInlineSnapshot(`1`);
expect(result.passes).toContain('first-contentful-paint passing');
expect(result.failures).toContain('viewport failure');
Expand Down
3 changes: 1 addition & 2 deletions packages/cli/test/cli.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -440,8 +440,7 @@ describe('Lighthouse CI CLI', () => {
1 result(s) for http://localhost:XXXX/app/ :

X resource-summary.script.size failure for maxNumericValue assertion
Keep request counts low and transfer sizes small
https://web.dev/use-lighthouse-for-performance-budgets/
Resources Summary

expected: <=XXXX
found: XXXX
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@ import lhr930A_ from '../../../../../test/fixtures/lh-9-3-0-coursehero-a.json';
import lhr930B_ from '../../../../../test/fixtures/lh-9-3-0-coursehero-b.json';
import lhr1010A_ from '../../../../../test/fixtures/lh-10-1-0-coursehero-a.json';
import lhr1010B_ from '../../../../../test/fixtures/lh-10-1-0-coursehero-b.json';
import lhr1140A_ from '../../../../../test/fixtures/lh-11-4-0-coursehero-a.json';
import lhr1140B_ from '../../../../../test/fixtures/lh-11-4-0-coursehero-b.json';
import lhrSubitemsA_ from '../../../../../test/fixtures/lh-subitems-a.json';
import lhrSubitemsB_ from '../../../../../test/fixtures/lh-subitems-b.json';
import lhrPsi800A_ from '../../../../../test/fixtures/psi-8-0-0-dkdev-a.json';
Expand All @@ -50,6 +52,8 @@ const lhr930A = /** @type {any} */ (lhr930A_);
const lhr930B = /** @type {any} */ (lhr930B_);
const lhr1010A = /** @type {any} */ (lhr1010A_);
const lhr1010B = /** @type {any} */ (lhr1010B_);
const lhr1140A = /** @type {any} */ (lhr1140A_);
const lhr1140B = /** @type {any} */ (lhr1140B_);
const lhrSubitemsA = /** @type {any} */ (lhrSubitemsA_);
const lhrSubitemsB = /** @type {any} */ (lhrSubitemsB_);
const lhrPsi800A = /** @type {any} */ (lhrPsi800A_);
Expand All @@ -63,6 +67,7 @@ const auditPairs700 = createAuditPairs(lhr700A, lhr700B);
const auditPairs800 = createAuditPairs(lhr800A, lhr800B);
const auditPairs930 = createAuditPairs(lhr930A, lhr930B);
const auditPairs1010 = createAuditPairs(lhr1010A, lhr1010B);
const auditPairs1140 = createAuditPairs(lhr1140A, lhr1140B);
const auditPairsPsi800 = createAuditPairs(lhrPsi800A, lhrPsi800B);
const auditPairsSubitems = createAuditPairs(lhrSubitemsA, lhrSubitemsB, {
filter: pair =>
Expand Down Expand Up @@ -147,6 +152,15 @@ export const Version1010 = () => (
/>
);

export const Version1140 = () => (
<AuditDetailPane
selectedAuditId={auditPairs1140[1].audit.id || ''}
setSelectedAuditId={action('setSelectedAuditId')}
pairs={auditPairs1140}
baseLhr={lhr1140B}
/>
);

export const VersionPsi800 = () => (
<AuditDetailPane
selectedAuditId={auditPairsPsi800[1].audit.id || ''}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@ import lhr930A_ from '../../../../test/fixtures/lh-9-3-0-coursehero-a.json';
import lhr930B_ from '../../../../test/fixtures/lh-9-3-0-coursehero-b.json';
import lhr1010A_ from '../../../../test/fixtures/lh-10-1-0-coursehero-a.json';
import lhr1010B_ from '../../../../test/fixtures/lh-10-1-0-coursehero-b.json';
import lhr1140A_ from '../../../../test/fixtures/lh-11-4-0-coursehero-a.json';
import lhr1140B_ from '../../../../test/fixtures/lh-11-4-0-coursehero-b.json';
import lhrPsi800A_ from '../../../../test/fixtures/psi-8-0-0-dkdev-a.json';
import lhrPsi800B_ from '../../../../test/fixtures/psi-8-0-0-dkdev-b.json';

Expand All @@ -46,6 +48,8 @@ const lhr930A = /** @type {any} */ (lhr930A_);
const lhr930B = /** @type {any} */ (lhr930B_);
const lhr1010A = /** @type {any} */ (lhr1010A_);
const lhr1010B = /** @type {any} */ (lhr1010B_);
const lhr1140A = /** @type {any} */ (lhr1140A_);
const lhr1140B = /** @type {any} */ (lhr1140B_);
const lhrPsi800A = /** @type {any} */ (lhrPsi800A_);
const lhrPsi800B = /** @type {any} */ (lhrPsi800B_);

Expand Down Expand Up @@ -100,6 +104,12 @@ export const Version1010 = () => (
</Wrapper>
);

export const Version1140 = () => (
<Wrapper>
<LhrComparison lhr={lhr1140A} baseLhr={lhr1140B} hookElements={{}} />
</Wrapper>
);

export const VersionPsi800 = () => (
<Wrapper>
<LhrComparison lhr={lhrPsi800A} baseLhr={lhrPsi800B} hookElements={{}} />
Expand Down
12 changes: 12 additions & 0 deletions packages/server/test/api/statistic-definitions.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@ const baseLhr800_ = require('../fixtures/lh-8-0-0-coursehero-a.json');
const baselhr930_ = require('../fixtures/lh-9-3-0-coursehero-a.json');
/** @type {any} */
const baselhr1010_ = require('../fixtures/lh-10-1-0-coursehero-a.json');
/** @type {any} */
const baselhr1140_ = require('../fixtures/lh-11-4-0-coursehero-a.json');
const {definitions} = require('../../src/api/statistic-definitions.js');

describe('Statistic Definitions', () => {
Expand All @@ -42,6 +44,8 @@ describe('Statistic Definitions', () => {
const baselhr930 = baselhr930_;
/** @type {LH.Result} */
const baselhr1010 = baselhr1010_;
/** @type {LH.Result} */
const baselhr1140 = baselhr1140_;

describe('meta_lighthouse_version()', () => {
const run = definitions.meta_lighthouse_version;
Expand All @@ -55,6 +59,7 @@ describe('Statistic Definitions', () => {
expect(run([baseLhr800])).toEqual({value: 80000});
expect(run([baselhr930])).toEqual({value: 90300});
expect(run([baselhr1010])).toEqual({value: 100100});
expect(run([baselhr1140])).toEqual({value: 110400});
expect(run([{...baseLhr5, lighthouseVersion: '1.2.3-beta.0'}])).toEqual({value: 10203});
});

Expand All @@ -80,6 +85,7 @@ describe('Statistic Definitions', () => {
expect(run([high, baseLhr800, low]).value).toBeCloseTo(20822.103);
expect(run([high, baselhr930, low]).value).toBeCloseTo(20525.578);
expect(run([high, baselhr1010, low]).value).toBeCloseTo(21627.392);
expect(run([high, baselhr1140, low]).value).toBeCloseTo(80796.283);
});
});

Expand All @@ -99,6 +105,7 @@ describe('Statistic Definitions', () => {
expect(run([high, baseLhr800, low]).value).toBeCloseTo(0.24);
expect(run([high, baselhr930, low]).value).toBeCloseTo(0.23);
expect(run([high, baselhr1010, low]).value).toBeCloseTo(0.21);
expect(run([high, baselhr1140, low]).value).toBeCloseTo(0.32);
});
});

Expand All @@ -118,6 +125,7 @@ describe('Statistic Definitions', () => {
expect(run([high, baseLhr800, low]).value).toBeCloseTo(0.01);
expect(run([high, baselhr930, low]).value).toBeCloseTo(0.01);
expect(run([high, baselhr1010, low]).value).toBeCloseTo(0.01);
expect(run([high, baselhr1140, low]).value).toBeCloseTo(0.01);
});
});

Expand All @@ -137,6 +145,7 @@ describe('Statistic Definitions', () => {
expect(run([high, baseLhr800, low]).value).toBeCloseTo(0.99);
expect(run([high, baselhr930, low]).value).toBeCloseTo(0.99);
expect(run([high, baselhr1010, low]).value).toBeCloseTo(0.99);
expect(run([high, baselhr1140, low]).value).toBeCloseTo(0.99);
});
});

Expand All @@ -150,6 +159,7 @@ describe('Statistic Definitions', () => {
expect(definitions['auditgroup_a11y-aria_pass']([baseLhr800])).toEqual({value: 6});
expect(definitions['auditgroup_a11y-aria_pass']([baselhr930])).toEqual({value: 8});
expect(definitions['auditgroup_a11y-aria_pass']([baselhr1010])).toEqual({value: 8});
expect(definitions['auditgroup_a11y-aria_pass']([baselhr1140])).toEqual({value: 9});
expect(definitions['auditgroup_a11y-color-contrast_fail']([baseLhr5])).toEqual({value: 0});
expect(definitions['auditgroup_a11y-color-contrast_fail']([baseLhr6])).toEqual({value: 1});
expect(definitions['auditgroup_a11y-color-contrast_fail']([baseLhr62])).toEqual({value: 1});
Expand All @@ -158,6 +168,7 @@ describe('Statistic Definitions', () => {
expect(definitions['auditgroup_a11y-color-contrast_fail']([baseLhr800])).toEqual({value: 1});
expect(definitions['auditgroup_a11y-color-contrast_fail']([baselhr930])).toEqual({value: 1});
expect(definitions['auditgroup_a11y-color-contrast_fail']([baselhr1010])).toEqual({value: 1});
expect(definitions['auditgroup_a11y-color-contrast_fail']([baselhr1140])).toEqual({value: 1});
expect(definitions['auditgroup_a11y-aria_na']([baseLhr5])).toEqual({value: 0});
expect(definitions['auditgroup_a11y-aria_na']([baseLhr6])).toEqual({value: 2});
expect(definitions['auditgroup_a11y-aria_na']([baseLhr62])).toEqual({value: 2});
Expand All @@ -166,6 +177,7 @@ describe('Statistic Definitions', () => {
expect(definitions['auditgroup_a11y-aria_na']([baseLhr800])).toEqual({value: 11});
expect(definitions['auditgroup_a11y-aria_na']([baselhr930])).toEqual({value: 9});
expect(definitions['auditgroup_a11y-aria_na']([baselhr1010])).toEqual({value: 9});
expect(definitions['auditgroup_a11y-aria_na']([baselhr1140])).toEqual({value: 9});
});
});
});
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,11 @@ describe('Project dashboard', () => {

expect(commits).toMatchInlineSnapshot(`
[
"1252build 18call_splitmasterMay 28 6:00 AM",
"1251build 17call_splitmasterMay 27 6:00 AM",
"1250build 16call_splitmasterMay 26 6:00 AM",
"1249build 15call_splitmasterMay 25 6:00 AM",
"1248build 14call_splitmasterMay 24 6:00 AM",
"1247build 13call_splitmasterMay 23 6:00 AM",
"1246build 12call_splitmasterMay 22 6:00 AM",
]
`);
});
Expand All @@ -45,7 +45,9 @@ describe('Project dashboard', () => {
it('should render graphs for previously unavailable data', async () => {
await state.page.evaluate(() => {
const graphs = Array.from(document.querySelectorAll('.metric-line-graph__graph'));
if (graphs.length !== 2) throw new Error('Should have found 2 metric graphs');
if (graphs.length !== 2) {
throw new Error(`Should have found 2 metric graphs, but got ${graphs.length}`);
}

window.scrollTo({top: graphs[0].getBoundingClientRect().top - 50});
return new Promise(resolve => requestAnimationFrame(resolve));
Expand Down
Loading
Loading