Skip to content

Commit

Permalink
feat: upgrade to lighthouse 9.3.0 (#726)
Browse files Browse the repository at this point in the history
BREAKING CHANGE: upgrade to lighthouse v9.3.0
  • Loading branch information
connorjclark committed Feb 1, 2022
1 parent 0fe68af commit 6e4585d
Show file tree
Hide file tree
Showing 24 changed files with 45,742 additions and 202 deletions.
1 change: 1 addition & 0 deletions docs/version-policy.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ Breaking changes come from many sources within LHCI and have a much stricter def

| Change | Impact | Expected Frequency |
| --------------------------------------------------------- | -------- | ------------------ |
| New minimum Node version | Moderate | 1/year |
| Lighthouse minor version bump that introduces a new audit | Low | 3-6/year |
| Lighthouse major version bump | Moderate | 1-2/year |
| LHCI server API format change (removal of data) | Moderate | 1-2/year |
Expand Down
2 changes: 1 addition & 1 deletion packages/cli/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
"express": "^4.17.1",
"inquirer": "^6.3.1",
"isomorphic-fetch": "^3.0.0",
"lighthouse": "8.0.0",
"lighthouse": "9.3.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(`100`);
expect(result.failures.length).toMatchInlineSnapshot(`99`);
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(`92`);
expect(result.failures.length).toMatchInlineSnapshot(`91`);
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(`100`);
expect(result.failures.length).toMatchInlineSnapshot(`99`);
expect(result.passes.length).toMatchInlineSnapshot(`1`);
expect(result.passes).toContain('first-contentful-paint passing');
expect(result.failures).toContain('viewport failure');
Expand Down
31 changes: 18 additions & 13 deletions packages/cli/test/test-utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -51,19 +51,24 @@ async function writeAllInputs(wizardProcess, inputs) {

/** @param {string} output */
function cleanStdOutput(output) {
return output
.replace(//g, 'X')
.replace(/×/g, 'X')
.replace(/[0-9a-f-]{36}/gi, '<UUID>')
.replace(/:\d{4,6}/g, ':XXXX')
.replace(/port \d{4,6}/, 'port XXXX')
.replace(/(\s+at \S+) .*/g, '$1')
.replace(/\s+at (async|processTicksAndRejections|process._tickCallback)(?=\n|$)/g, '')
.replace(
/appspot.com\/reports\/[0-9-]+.report.html/g,
'appspot.com/reports/XXXX-XXXX.report.html'
)
.replace(/\d{4,}(\.\d{1,})?/g, 'XXXX');
return (
output
.replace(//g, 'X')
.replace(/×/g, 'X')
.replace(/[0-9a-f-]{36}/gi, '<UUID>')
.replace(/:\d{4,6}/g, ':XXXX')
.replace(/port \d{4,6}/, 'port XXXX')
.replace(/(\s+at \S+) .*/g, '$1')
.replace(/\s+at (async|processTicksAndRejections|process._tickCallback)(?=\n|$)/g, '')
.replace(
/appspot.com\/reports\/[0-9-]+.report.html/g,
'appspot.com/reports/XXXX-XXXX.report.html'
)
// 1234.1, 1234
.replace(/\d{4,}(\.\d{1,})?/g, 'XXXX')
// 123.1
.replace(/\d{3,}(\.\d{1,})/g, 'XXXX')
);
}

async function safeDeleteFile(filePath) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ import lhr700A_ from '../../../../../test/fixtures/lh-7-0-0-coursehero-a.json';
import lhr700B_ from '../../../../../test/fixtures/lh-7-0-0-coursehero-b.json';
import lhr800A_ from '../../../../../test/fixtures/lh-8-0-0-coursehero-a.json';
import lhr800B_ from '../../../../../test/fixtures/lh-8-0-0-coursehero-b.json';
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 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 @@ -42,6 +44,8 @@ const lhr700A = /** @type {any} */ (lhr700A_);
const lhr700B = /** @type {any} */ (lhr700B_);
const lhr800A = /** @type {any} */ (lhr800A_);
const lhr800B = /** @type {any} */ (lhr800B_);
const lhr930A = /** @type {any} */ (lhr930A_);
const lhr930B = /** @type {any} */ (lhr930B_);
const lhrSubitemsA = /** @type {any} */ (lhrSubitemsA_);
const lhrSubitemsB = /** @type {any} */ (lhrSubitemsB_);
const lhrPsi800A = /** @type {any} */ (lhrPsi800A_);
Expand All @@ -53,6 +57,7 @@ const auditPairs62 = createAuditPairs(lhr62A, lhr62B);
const auditPairs641 = createAuditPairs(lhr641A, lhr641B);
const auditPairs700 = createAuditPairs(lhr700A, lhr700B);
const auditPairs800 = createAuditPairs(lhr800A, lhr800B);
const auditPairs930 = createAuditPairs(lhr930A, lhr930B);
const auditPairsPsi800 = createAuditPairs(lhrPsi800A, lhrPsi800B);
const auditPairsSubitems = createAuditPairs(lhrSubitemsA, lhrSubitemsB, {
filter: pair =>
Expand Down Expand Up @@ -119,6 +124,15 @@ export const Version800 = () => (
/>
);

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

export const VersionPsi800 = () => (
<AuditDetailPane
selectedAuditId={auditPairsPsi800[1].audit.id || ''}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ import lhr700A_ from '../../../../test/fixtures/lh-7-0-0-coursehero-a.json';
import lhr700B_ from '../../../../test/fixtures/lh-7-0-0-coursehero-b.json';
import lhr800A_ from '../../../../test/fixtures/lh-8-0-0-coursehero-a.json';
import lhr800B_ from '../../../../test/fixtures/lh-8-0-0-coursehero-b.json';
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 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 @@ -38,6 +40,8 @@ const lhr700A = /** @type {any} */ (lhr700A_);
const lhr700B = /** @type {any} */ (lhr700B_);
const lhr800A = /** @type {any} */ (lhr800A_);
const lhr800B = /** @type {any} */ (lhr800B_);
const lhr930A = /** @type {any} */ (lhr930A_);
const lhr930B = /** @type {any} */ (lhr930B_);
const lhrPsi800A = /** @type {any} */ (lhrPsi800A_);
const lhrPsi800B = /** @type {any} */ (lhrPsi800B_);

Expand Down Expand Up @@ -79,6 +83,13 @@ export const Version800 = () => (
<LhrComparison lhr={lhr800A} baseLhr={lhr800B} hookElements={{}} />
</Wrapper>
);

export const Version930 = () => (
<Wrapper>
<LhrComparison lhr={lhr930A} baseLhr={lhr930B} 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 @@ -19,6 +19,8 @@ const baseLhr641_ = require('../fixtures/lh-6-4-1-coursehero-a.json');
const baseLhr700_ = require('../fixtures/lh-7-0-0-coursehero-a.json');
/** @type {any} */
const baseLhr800_ = require('../fixtures/lh-8-0-0-coursehero-a.json');
/** @type {any} */
const baselhr930_ = require('../fixtures/lh-9-3-0-coursehero-a.json');
const {definitions} = require('../../src/api/statistic-definitions.js');

describe('Statistic Definitions', () => {
Expand All @@ -34,6 +36,8 @@ describe('Statistic Definitions', () => {
const baseLhr700 = baseLhr700_;
/** @type {LH.Result} */
const baseLhr800 = baseLhr800_;
/** @type {LH.Result} */
const baselhr930 = baselhr930_;

describe('meta_lighthouse_version()', () => {
const run = definitions.meta_lighthouse_version;
Expand All @@ -45,6 +49,7 @@ describe('Statistic Definitions', () => {
expect(run([baseLhr641])).toEqual({value: 60401});
expect(run([baseLhr700])).toEqual({value: 70000});
expect(run([baseLhr800])).toEqual({value: 80000});
expect(run([baselhr930])).toEqual({value: 90300});
expect(run([{...baseLhr5, lighthouseVersion: '1.2.3-beta.0'}])).toEqual({value: 10203});
});

Expand All @@ -68,6 +73,7 @@ describe('Statistic Definitions', () => {
expect(run([high, baseLhr641, low]).value).toBeCloseTo(19945.48);
expect(run([high, baseLhr700, low]).value).toBeCloseTo(21206.92);
expect(run([high, baseLhr800, low]).value).toBeCloseTo(20822.103);
expect(run([high, baselhr930, low]).value).toBeCloseTo(20525.578);
});
});

Expand All @@ -85,6 +91,7 @@ describe('Statistic Definitions', () => {
expect(run([high, baseLhr641, low]).value).toBeCloseTo(0.2);
expect(run([high, baseLhr700, low]).value).toBeCloseTo(0.18);
expect(run([high, baseLhr800, low]).value).toBeCloseTo(0.24);
expect(run([high, baselhr930, low]).value).toBeCloseTo(0.23);
});
});

Expand All @@ -102,6 +109,7 @@ describe('Statistic Definitions', () => {
expect(run([high, baseLhr641, low]).value).toBeCloseTo(0.01);
expect(run([high, baseLhr700, low]).value).toBeCloseTo(0.01);
expect(run([high, baseLhr800, low]).value).toBeCloseTo(0.01);
expect(run([high, baselhr930, low]).value).toBeCloseTo(0.01);
});
});

Expand All @@ -119,6 +127,7 @@ describe('Statistic Definitions', () => {
expect(run([high, baseLhr641, low]).value).toBeCloseTo(0.99);
expect(run([high, baseLhr700, low]).value).toBeCloseTo(0.99);
expect(run([high, baseLhr800, low]).value).toBeCloseTo(0.99);
expect(run([high, baselhr930, low]).value).toBeCloseTo(0.99);
});
});

Expand All @@ -130,18 +139,21 @@ describe('Statistic Definitions', () => {
expect(definitions['auditgroup_a11y-aria_pass']([baseLhr641])).toEqual({value: 10});
expect(definitions['auditgroup_a11y-aria_pass']([baseLhr700])).toEqual({value: 10});
expect(definitions['auditgroup_a11y-aria_pass']([baseLhr800])).toEqual({value: 6});
expect(definitions['auditgroup_a11y-aria_pass']([baselhr930])).toEqual({value: 8});
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});
expect(definitions['auditgroup_a11y-color-contrast_fail']([baseLhr641])).toEqual({value: 1});
expect(definitions['auditgroup_a11y-color-contrast_fail']([baseLhr700])).toEqual({value: 1});
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-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});
expect(definitions['auditgroup_a11y-aria_na']([baseLhr641])).toEqual({value: 2});
expect(definitions['auditgroup_a11y-aria_na']([baseLhr700])).toEqual({value: 7});
expect(definitions['auditgroup_a11y-aria_na']([baseLhr800])).toEqual({value: 11});
expect(definitions['auditgroup_a11y-aria_na']([baselhr930])).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 @@ -28,11 +28,11 @@ describe('Project dashboard', () => {

expect(commits).toMatchInlineSnapshot(`
Array [
"1248build 14call_splitmasterMay 24 6:00 AM",
"1247build 13call_splitmasterMay 23 6:00 AM",
"1246build 12call_splitmasterMay 22 6:00 AM",
"1245build 11call_splitmasterMay 21 6:00 AM",
"1244build 10call_splitmasterMay 20 6:00 AM",
"1243build 9call_splitmasterMay 19 6:00 AM",
"1242build 8call_splitmasterMay 18 6:00 AM",
]
`);
});
Expand Down
Loading

0 comments on commit 6e4585d

Please sign in to comment.