lighthouse 8.4.0 → 8.5.0-dev.20210921
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/changelog.md +79 -0
- package/flow-report/assets/styles.css +85 -61
- package/flow-report/src/app.tsx +6 -2
- package/flow-report/src/common.tsx +0 -41
- package/flow-report/src/icons.tsx +11 -0
- package/flow-report/src/summary/summary.tsx +32 -25
- package/flow-report/src/topbar.tsx +60 -0
- package/flow-report/src/util.ts +0 -1
- package/flow-report/src/wrappers/{gauge.tsx → category-score.tsx} +11 -5
- package/flow-report/test/summary/summary-test.tsx +3 -3
- package/flow-report/tsconfig.json +6 -22
- package/{lighthouse-core/gather/gatherers/gather-context.js → lighthouse-cli/.eslintrc.cjs} +20 -18
- package/lighthouse-cli/bin.js +31 -21
- package/lighthouse-cli/cli-flags.js +12 -7
- package/lighthouse-cli/commands/commands.js +2 -7
- package/lighthouse-cli/commands/list-audits.js +2 -2
- package/lighthouse-cli/commands/list-trace-categories.js +2 -2
- package/lighthouse-cli/index.js +3 -1
- package/lighthouse-cli/package.json +4 -0
- package/lighthouse-cli/printer.js +4 -3
- package/lighthouse-cli/run.js +14 -15
- package/lighthouse-cli/sentry-prompt.js +5 -6
- package/lighthouse-cli/test/smokehouse/frontends/back-compat-util.js +1 -1
- package/lighthouse-cli/test/smokehouse/frontends/lib.js +5 -4
- package/lighthouse-cli/test/smokehouse/frontends/node.js +1 -1
- package/lighthouse-cli/test/smokehouse/frontends/smokehouse-bin.js +93 -14
- package/lighthouse-cli/test/smokehouse/lib/child-process-error.js +1 -1
- package/lighthouse-cli/test/smokehouse/lib/concurrent-mapper.js +1 -1
- package/lighthouse-cli/test/smokehouse/lib/local-console.js +1 -1
- package/lighthouse-cli/test/smokehouse/lighthouse-runners/bundle.js +20 -16
- package/lighthouse-cli/test/smokehouse/lighthouse-runners/cli.js +15 -12
- package/lighthouse-cli/test/smokehouse/report-assert.js +23 -13
- package/lighthouse-cli/test/smokehouse/smokehouse.js +32 -11
- package/lighthouse-core/audits/byte-efficiency/byte-efficiency-audit.js +0 -2
- package/lighthouse-core/audits/byte-efficiency/uses-responsive-images-snapshot.js +6 -1
- package/lighthouse-core/audits/dobetterweb/js-libraries.js +5 -0
- package/lighthouse-core/audits/dobetterweb/uses-http2.js +1 -0
- package/lighthouse-core/audits/lcp-lazy-loaded.js +1 -0
- package/lighthouse-core/audits/oopif-iframe-test-audit.js +30 -0
- package/lighthouse-core/computed/metrics/metric.js +2 -1
- package/lighthouse-core/config/config-helpers.js +47 -3
- package/lighthouse-core/config/config.js +3 -46
- package/lighthouse-core/config/default-config.js +0 -1
- package/lighthouse-core/fraggle-rock/config/config.js +22 -4
- package/lighthouse-core/fraggle-rock/config/default-config.js +0 -9
- package/lighthouse-core/fraggle-rock/config/filters.js +3 -0
- package/lighthouse-core/fraggle-rock/config/validation.js +19 -1
- package/lighthouse-core/fraggle-rock/gather/base-artifacts.js +8 -3
- package/lighthouse-core/fraggle-rock/gather/driver.js +10 -0
- package/lighthouse-core/fraggle-rock/gather/navigation-runner.js +40 -19
- package/lighthouse-core/fraggle-rock/gather/runner-helpers.js +3 -0
- package/lighthouse-core/fraggle-rock/gather/session.js +44 -1
- package/lighthouse-core/fraggle-rock/gather/snapshot-runner.js +4 -1
- package/lighthouse-core/fraggle-rock/gather/timespan-runner.js +5 -1
- package/lighthouse-core/gather/devtools-log.js +9 -3
- package/lighthouse-core/gather/driver/network-monitor.js +57 -13
- package/lighthouse-core/gather/driver/prepare.js +43 -17
- package/lighthouse-core/gather/driver/target-manager.js +125 -0
- package/lighthouse-core/gather/driver.js +20 -0
- package/lighthouse-core/gather/fetcher.js +2 -2
- package/lighthouse-core/gather/gather-runner.js +1 -1
- package/lighthouse-core/gather/gatherers/css-usage.js +0 -2
- package/lighthouse-core/gather/gatherers/devtools-log.js +11 -9
- package/lighthouse-core/gather/gatherers/js-usage.js +0 -1
- package/lighthouse-core/gather/gatherers/script-elements.js +4 -5
- package/lighthouse-core/gather/gatherers/seo/robots-txt.js +3 -3
- package/lighthouse-core/gather/gatherers/trace.js +4 -5
- package/lighthouse-core/index.js +4 -0
- package/lighthouse-core/lib/emulation.js +0 -1
- package/lighthouse-core/lib/i18n/locales/en-US.json +6 -0
- package/lighthouse-core/lib/i18n/locales/en-XL.json +6 -0
- package/lighthouse-core/lib/network-recorder.js +8 -0
- package/lighthouse-core/lib/proto-preprocessor.js +5 -10
- package/lighthouse-core/runner.js +1 -3
- package/package.json +12 -9
- package/readme.md +2 -0
- package/report/assets/styles.css +120 -12
- package/report/assets/templates.html +13 -0
- package/report/clients/psi.js +5 -1
- package/report/generator/tsconfig.json +5 -16
- package/report/renderer/category-renderer.js +58 -5
- package/report/renderer/components.js +25 -5
- package/report/renderer/performance-category-renderer.js +5 -5
- package/report/renderer/pwa-category-renderer.js +10 -0
- package/report/renderer/report-renderer.js +12 -3
- package/report/renderer/report-ui-features.js +1 -4
- package/report/test/renderer/category-renderer-test.js +19 -0
- package/report/tsconfig.json +6 -21
- package/report/types/report-result.d.ts +1 -1
- package/root.js +3 -1
- package/third-party/snyk/snapshot.json +2 -2
- package/tsconfig-all.json +15 -0
- package/tsconfig-base.json +24 -0
- package/tsconfig.json +8 -18
- package/types/artifacts.d.ts +7 -7
- package/types/config.d.ts +1 -1
- package/types/gatherer.d.ts +7 -1
- package/types/lhr/flow.d.ts +0 -1
- package/types/lhr/lhr.d.ts +5 -1
- package/types/lhr/tsconfig.json +4 -14
- package/types/protocol.d.ts +2 -0
- package/types/smokehouse.d.ts +2 -1
- package/dist/report/flow.js +0 -149
- package/dist/report/standalone.js +0 -228
- package/flow-report/test/common-test.tsx +0 -131
- package/lighthouse-core/gather/gatherers/host-form-factor.js +0 -31
- package/lighthouse-core/gather/gatherers/host-user-agent.js +0 -29
|
@@ -1,131 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @license Copyright 2021 The Lighthouse Authors. All Rights Reserved.
|
|
3
|
-
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
|
|
4
|
-
* Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
|
|
5
|
-
*/
|
|
6
|
-
|
|
7
|
-
import {render} from '@testing-library/preact';
|
|
8
|
-
|
|
9
|
-
import {CategoryRatio} from '../src/common';
|
|
10
|
-
|
|
11
|
-
describe('CategoryRatio', () => {
|
|
12
|
-
it('renders passed audit count', async () => {
|
|
13
|
-
const audits = {
|
|
14
|
-
'audit1': {score: 1},
|
|
15
|
-
'audit2': {score: 1},
|
|
16
|
-
'audit3': {score: 0},
|
|
17
|
-
} as any;
|
|
18
|
-
const category = {
|
|
19
|
-
auditRefs: [
|
|
20
|
-
{id: 'audit1', weight: 1},
|
|
21
|
-
{id: 'audit2', weight: 0},
|
|
22
|
-
{id: 'audit3', weight: 1},
|
|
23
|
-
],
|
|
24
|
-
} as any;
|
|
25
|
-
|
|
26
|
-
const root = render(<CategoryRatio
|
|
27
|
-
audits={audits}
|
|
28
|
-
category={category}
|
|
29
|
-
href="index=0&achor=seo"
|
|
30
|
-
/>);
|
|
31
|
-
const link = root.getByRole('link');
|
|
32
|
-
|
|
33
|
-
expect(link.className).toEqual('CategoryRatio CategoryRatio--average');
|
|
34
|
-
expect(link.textContent).toEqual('2/3');
|
|
35
|
-
});
|
|
36
|
-
|
|
37
|
-
it('renders passed audit count with fail rating', async () => {
|
|
38
|
-
const audits = {
|
|
39
|
-
'audit1': {score: 0},
|
|
40
|
-
'audit2': {score: 0},
|
|
41
|
-
'audit3': {score: 0},
|
|
42
|
-
} as any;
|
|
43
|
-
const category = {
|
|
44
|
-
auditRefs: [
|
|
45
|
-
{id: 'audit1', weight: 1},
|
|
46
|
-
{id: 'audit2', weight: 1},
|
|
47
|
-
{id: 'audit3', weight: 1},
|
|
48
|
-
],
|
|
49
|
-
} as any;
|
|
50
|
-
|
|
51
|
-
const root = render(<CategoryRatio
|
|
52
|
-
audits={audits}
|
|
53
|
-
category={category}
|
|
54
|
-
href="index=0&achor=seo"
|
|
55
|
-
/>);
|
|
56
|
-
const link = root.getByRole('link');
|
|
57
|
-
|
|
58
|
-
expect(link.className).toEqual('CategoryRatio CategoryRatio--fail');
|
|
59
|
-
expect(link.textContent).toEqual('0/3');
|
|
60
|
-
});
|
|
61
|
-
|
|
62
|
-
it('renders passed audit count with pass rating', async () => {
|
|
63
|
-
const audits = {
|
|
64
|
-
'audit1': {score: 1},
|
|
65
|
-
'audit2': {score: 1},
|
|
66
|
-
'audit3': {score: 1},
|
|
67
|
-
} as any;
|
|
68
|
-
const category = {
|
|
69
|
-
auditRefs: [
|
|
70
|
-
{id: 'audit1', weight: 1},
|
|
71
|
-
{id: 'audit2', weight: 1},
|
|
72
|
-
{id: 'audit3', weight: 1},
|
|
73
|
-
],
|
|
74
|
-
} as any;
|
|
75
|
-
|
|
76
|
-
const root = render(<CategoryRatio
|
|
77
|
-
audits={audits}
|
|
78
|
-
category={category}
|
|
79
|
-
href="index=0&achor=seo"
|
|
80
|
-
/>);
|
|
81
|
-
const link = root.getByRole('link');
|
|
82
|
-
|
|
83
|
-
expect(link.className).toEqual('CategoryRatio CategoryRatio--pass');
|
|
84
|
-
expect(link.textContent).toEqual('3/3');
|
|
85
|
-
});
|
|
86
|
-
|
|
87
|
-
it('uses null rating of no audits have weight', async () => {
|
|
88
|
-
const audits = {
|
|
89
|
-
'audit1': {score: 1},
|
|
90
|
-
'audit2': {score: 0},
|
|
91
|
-
} as any;
|
|
92
|
-
const category = {
|
|
93
|
-
auditRefs: [
|
|
94
|
-
{id: 'audit1', weight: 0},
|
|
95
|
-
{id: 'audit2', weight: 0},
|
|
96
|
-
],
|
|
97
|
-
} as any;
|
|
98
|
-
|
|
99
|
-
const root = render(<CategoryRatio
|
|
100
|
-
audits={audits}
|
|
101
|
-
category={category}
|
|
102
|
-
href="index=0&achor=seo"
|
|
103
|
-
/>);
|
|
104
|
-
const link = root.getByRole('link');
|
|
105
|
-
|
|
106
|
-
expect(link.className).toEqual('CategoryRatio CategoryRatio--null');
|
|
107
|
-
expect(link.textContent).toEqual('1/2');
|
|
108
|
-
});
|
|
109
|
-
|
|
110
|
-
it('treats audit ref with no matching score as fail', async () => {
|
|
111
|
-
const audits = {
|
|
112
|
-
'audit1': {score: 1},
|
|
113
|
-
} as any;
|
|
114
|
-
const category = {
|
|
115
|
-
auditRefs: [
|
|
116
|
-
{id: 'audit1', weight: 1},
|
|
117
|
-
{id: 'audit2', weight: 1},
|
|
118
|
-
],
|
|
119
|
-
} as any;
|
|
120
|
-
|
|
121
|
-
const root = render(<CategoryRatio
|
|
122
|
-
audits={audits}
|
|
123
|
-
category={category}
|
|
124
|
-
href="index=0&achor=seo"
|
|
125
|
-
/>);
|
|
126
|
-
const link = root.getByRole('link');
|
|
127
|
-
|
|
128
|
-
expect(link.className).toEqual('CategoryRatio CategoryRatio--average');
|
|
129
|
-
expect(link.textContent).toEqual('1/2');
|
|
130
|
-
});
|
|
131
|
-
});
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @license Copyright 2021 The Lighthouse Authors. All Rights Reserved.
|
|
3
|
-
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
|
|
4
|
-
* Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
|
|
5
|
-
*/
|
|
6
|
-
'use strict';
|
|
7
|
-
|
|
8
|
-
const FRGatherer = require('../../fraggle-rock/gather/base-gatherer.js');
|
|
9
|
-
const HostUserAgent = require('./host-user-agent.js');
|
|
10
|
-
|
|
11
|
-
class HostFormFactor extends FRGatherer {
|
|
12
|
-
static symbol = Symbol('HostFormFactor');
|
|
13
|
-
|
|
14
|
-
/** @type {LH.Gatherer.GathererMeta<'HostUserAgent'>} */
|
|
15
|
-
meta = {
|
|
16
|
-
symbol: HostFormFactor.symbol,
|
|
17
|
-
supportedModes: ['snapshot', 'timespan', 'navigation'],
|
|
18
|
-
dependencies: {HostUserAgent: HostUserAgent.symbol},
|
|
19
|
-
};
|
|
20
|
-
|
|
21
|
-
/**
|
|
22
|
-
* @param {LH.Gatherer.FRTransitionalContext<'HostUserAgent'>} context
|
|
23
|
-
* @return {Promise<LH.Artifacts['HostFormFactor']>}
|
|
24
|
-
*/
|
|
25
|
-
async getArtifact(context) {
|
|
26
|
-
const userAgent = context.dependencies.HostUserAgent;
|
|
27
|
-
return userAgent.includes('Android') || userAgent.includes('Mobile') ? 'mobile' : 'desktop';
|
|
28
|
-
}
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
module.exports = HostFormFactor;
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @license Copyright 2021 The Lighthouse Authors. All Rights Reserved.
|
|
3
|
-
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
|
|
4
|
-
* Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
|
|
5
|
-
*/
|
|
6
|
-
'use strict';
|
|
7
|
-
|
|
8
|
-
const FRGatherer = require('../../fraggle-rock/gather/base-gatherer.js');
|
|
9
|
-
const {getBrowserVersion} = require('../driver/environment.js');
|
|
10
|
-
|
|
11
|
-
class HostUserAgent extends FRGatherer {
|
|
12
|
-
static symbol = Symbol('HostUserAgent');
|
|
13
|
-
|
|
14
|
-
/** @type {LH.Gatherer.GathererMeta} */
|
|
15
|
-
meta = {
|
|
16
|
-
symbol: HostUserAgent.symbol,
|
|
17
|
-
supportedModes: ['snapshot', 'timespan', 'navigation'],
|
|
18
|
-
};
|
|
19
|
-
|
|
20
|
-
/**
|
|
21
|
-
* @param {LH.Gatherer.FRTransitionalContext} context
|
|
22
|
-
* @return {Promise<LH.Artifacts['HostUserAgent']>}
|
|
23
|
-
*/
|
|
24
|
-
getArtifact(context) {
|
|
25
|
-
return getBrowserVersion(context.driver.defaultSession).then(v => v.userAgent);
|
|
26
|
-
}
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
module.exports = HostUserAgent;
|