Skip to content
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 @@
"proxy-agent": "^6.4.0",
"inquirer": "^6.3.1",
"isomorphic-fetch": "^3.0.0",
"lighthouse": "12.1.0",
"lighthouse": "12.6.1",
"lighthouse-logger": "1.2.0",
"open": "^7.1.0",
"tmp": "^0.1.0",
Expand Down
12 changes: 6 additions & 6 deletions packages/cli/test/assert.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,8 @@ 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(`108`);
expect(result.warnings.length).toMatchInlineSnapshot(`16`);
expect(result.failures.length).toMatchInlineSnapshot(`125`);
expect(result.warnings.length).toMatchInlineSnapshot(`19`);
expect(result.passes.length).toMatchInlineSnapshot(`0`);
expect(result.failures).toContain('deprecations failure');
expect(result.failures).toContain('viewport failure');
Expand All @@ -65,8 +65,8 @@ 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(`107`);
expect(result.warnings.length).toMatchInlineSnapshot(`15`);
expect(result.failures.length).toMatchInlineSnapshot(`124`);
expect(result.warnings.length).toMatchInlineSnapshot(`18`);
expect(result.passes.length).toMatchInlineSnapshot(`0`);
expect(result.failures).toContain('deprecations failure');
expect(result.failures).not.toContain('viewport failure');
Expand All @@ -91,8 +91,8 @@ describe('Lighthouse CI assert CLI', () => {
it('should return passing audits', async () => {
const result = await run([`--preset=lighthouse:recommended`, '--include-passed-assertions']);
expect(result.status).toEqual(1);
expect(result.warnings.length).toMatchInlineSnapshot(`16`);
expect(result.failures.length).toMatchInlineSnapshot(`108`);
expect(result.warnings.length).toMatchInlineSnapshot(`19`);
expect(result.failures.length).toMatchInlineSnapshot(`125`);
expect(result.passes.length).toMatchInlineSnapshot(`1`);
expect(result.passes).toContain('first-contentful-paint passing');
expect(result.failures).toContain('viewport failure');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@ 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 lhr1200A_ from '../../../../../test/fixtures/lh-12-0-0-coursehero-a.json';
import lhr1200B_ from '../../../../../test/fixtures/lh-12-0-0-coursehero-b.json';
import lhr1261A_ from '../../../../../test/fixtures/lh-12-6-1-coursehero-a.json';
import lhr1261B_ from '../../../../../test/fixtures/lh-12-6-1-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 Down Expand Up @@ -58,6 +60,8 @@ const lhr1140A = /** @type {any} */ (lhr1140A_);
const lhr1140B = /** @type {any} */ (lhr1140B_);
const lhr1200A = /** @type {any} */ (lhr1200A_);
const lhr1200B = /** @type {any} */ (lhr1200B_);
const lhr1261A = /** @type {any} */ (lhr1261A_);
const lhr1261B = /** @type {any} */ (lhr1261B_);
const lhrSubitemsA = /** @type {any} */ (lhrSubitemsA_);
const lhrSubitemsB = /** @type {any} */ (lhrSubitemsB_);
const lhrPsi800A = /** @type {any} */ (lhrPsi800A_);
Expand All @@ -73,6 +77,7 @@ const auditPairs930 = createAuditPairs(lhr930A, lhr930B);
const auditPairs1010 = createAuditPairs(lhr1010A, lhr1010B);
const auditPairs1140 = createAuditPairs(lhr1140A, lhr1140B);
const auditPairs1200 = createAuditPairs(lhr1200A, lhr1200B);
const auditPairs1261 = createAuditPairs(lhr1261A, lhr1261B);
const auditPairsPsi800 = createAuditPairs(lhrPsi800A, lhrPsi800B);
const auditPairsSubitems = createAuditPairs(lhrSubitemsA, lhrSubitemsB, {
filter: pair =>
Expand Down Expand Up @@ -175,6 +180,15 @@ export const Version1200 = () => (
/>
);

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

export const VersionPsi800 = () => (
<AuditDetailPane
selectedAuditId={auditPairsPsi800[1].audit.id || ''}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@ 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 lhr1200A_ from '../../../../test/fixtures/lh-12-0-0-coursehero-a.json';
import lhr1200B_ from '../../../../test/fixtures/lh-12-0-0-coursehero-b.json';
import lhr1261A_ from '../../../../test/fixtures/lh-12-6-1-coursehero-a.json';
import lhr1261B_ from '../../../../test/fixtures/lh-12-6-1-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 Down Expand Up @@ -54,6 +56,8 @@ const lhr1140A = /** @type {any} */ (lhr1140A_);
const lhr1140B = /** @type {any} */ (lhr1140B_);
const lhr1200A = /** @type {any} */ (lhr1200A_);
const lhr1200B = /** @type {any} */ (lhr1200B_);
const lhr1261A = /** @type {any} */ (lhr1261A_);
const lhr1261B = /** @type {any} */ (lhr1261B_);
const lhrPsi800A = /** @type {any} */ (lhrPsi800A_);
const lhrPsi800B = /** @type {any} */ (lhrPsi800B_);

Expand Down Expand Up @@ -120,6 +124,12 @@ export const Version1200 = () => (
</Wrapper>
);

export const Version1261 = () => (
<Wrapper>
<LhrComparison lhr={lhr1261A} baseLhr={lhr1261B} 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 @@ -27,6 +27,8 @@ const baselhr1010_ = require('../fixtures/lh-10-1-0-coursehero-a.json');
const baselhr1140_ = require('../fixtures/lh-11-4-0-coursehero-a.json');
/** @type {any} */
const baselhr1200_ = require('../fixtures/lh-12-0-0-coursehero-a.json');
/** @type {any} */
const baselhr1261_ = require('../fixtures/lh-12-6-1-coursehero-a.json');
const {definitions} = require('../../src/api/statistic-definitions.js');

describe('Statistic Definitions', () => {
Expand All @@ -50,6 +52,8 @@ describe('Statistic Definitions', () => {
const baselhr1140 = baselhr1140_;
/** @type {LH.Result} */
const baselhr1200 = baselhr1200_;
/** @type {LH.Result} */
const baselhr1261 = baselhr1261_;

describe('meta_lighthouse_version()', () => {
const run = definitions.meta_lighthouse_version;
Expand All @@ -65,6 +69,7 @@ describe('Statistic Definitions', () => {
expect(run([baselhr1010])).toEqual({value: 100100});
expect(run([baselhr1140])).toEqual({value: 110400});
expect(run([baselhr1200])).toEqual({value: 120000});
expect(run([baselhr1261])).toEqual({value: 120601});
expect(run([{...baseLhr5, lighthouseVersion: '1.2.3-beta.0'}])).toEqual({value: 10203});
});

Expand Down Expand Up @@ -92,6 +97,7 @@ describe('Statistic Definitions', () => {
expect(run([high, baselhr1010, low]).value).toBeCloseTo(21627.392);
expect(run([high, baselhr1140, low]).value).toBeCloseTo(80796.283);
expect(run([high, baselhr1200, low]).value).toBeCloseTo(82970.673);
expect(run([high, baselhr1261, low]).value).toBeCloseTo(84118.687);
});
});

Expand All @@ -113,6 +119,7 @@ describe('Statistic Definitions', () => {
expect(run([high, baselhr1010, low]).value).toBeCloseTo(0.21);
expect(run([high, baselhr1140, low]).value).toBeCloseTo(0.32);
expect(run([high, baselhr1200, low]).value).toBeCloseTo(0.34);
expect(run([high, baselhr1261, low]).value).toBeCloseTo(0.27);
});
});

Expand All @@ -134,6 +141,7 @@ describe('Statistic Definitions', () => {
expect(run([high, baselhr1010, low]).value).toBeCloseTo(0.01);
expect(run([high, baselhr1140, low]).value).toBeCloseTo(0.01);
expect(run([high, baselhr1200, low]).value).toBeCloseTo(0.01);
expect(run([high, baselhr1261, low]).value).toBeCloseTo(0.01);
});
});

Expand All @@ -155,6 +163,7 @@ describe('Statistic Definitions', () => {
expect(run([high, baselhr1010, low]).value).toBeCloseTo(0.99);
expect(run([high, baselhr1140, low]).value).toBeCloseTo(0.99);
expect(run([high, baselhr1200, low]).value).toBeCloseTo(0.99);
expect(run([high, baselhr1261, low]).value).toBeCloseTo(0.99);
});
});

Expand All @@ -170,6 +179,7 @@ describe('Statistic Definitions', () => {
expect(definitions['auditgroup_a11y-aria_pass']([baselhr1010])).toEqual({value: 8});
expect(definitions['auditgroup_a11y-aria_pass']([baselhr1140])).toEqual({value: 9});
expect(definitions['auditgroup_a11y-aria_pass']([baselhr1200])).toEqual({value: 12});
expect(definitions['auditgroup_a11y-aria_pass']([baselhr1261])).toEqual({value: 12});
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 @@ -180,6 +190,7 @@ describe('Statistic Definitions', () => {
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-color-contrast_fail']([baselhr1200])).toEqual({value: 1});
expect(definitions['auditgroup_a11y-color-contrast_fail']([baselhr1261])).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 @@ -190,6 +201,7 @@ describe('Statistic Definitions', () => {
expect(definitions['auditgroup_a11y-aria_na']([baselhr1010])).toEqual({value: 9});
expect(definitions['auditgroup_a11y-aria_na']([baselhr1140])).toEqual({value: 9});
expect(definitions['auditgroup_a11y-aria_na']([baselhr1200])).toEqual({value: 9});
expect(definitions['auditgroup_a11y-aria_na']([baselhr1261])).toEqual({value: 9});
});
});
});
Loading
Loading