lighthouse 8.6.0-dev.20211031 → 8.6.0-dev.20211101
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/dist/report/flow.js +7 -7
- package/dist/report/standalone.js +7 -7
- package/flow-report/src/app.tsx +10 -11
- package/flow-report/src/common.tsx +11 -5
- package/flow-report/src/header.tsx +3 -3
- package/flow-report/src/sidebar/flow.tsx +3 -3
- package/flow-report/src/sidebar/sidebar.tsx +3 -3
- package/flow-report/src/summary/category.tsx +2 -2
- package/flow-report/src/util.ts +12 -12
- package/flow-report/src/wrappers/report.tsx +11 -6
- package/flow-report/test/common-test.tsx +25 -10
- package/flow-report/test/header-test.tsx +6 -6
- package/flow-report/test/summary/category-test.tsx +5 -5
- package/flow-report/test/util-test.tsx +32 -11
- package/lighthouse-cli/test/smokehouse/lighthouse-runners/bundle.js +4 -2
- package/lighthouse-cli/test/smokehouse/smokehouse.js +1 -1
- package/lighthouse-core/computed/metrics/lantern-total-blocking-time.js +3 -4
- package/lighthouse-core/computed/metrics/tbt-utils.js +57 -0
- package/lighthouse-core/computed/metrics/total-blocking-time.js +3 -53
- package/lighthouse-core/config/config-helpers.js +20 -10
- package/lighthouse-core/config/default-config.js +59 -53
- package/lighthouse-core/fraggle-rock/config/default-config.js +1 -1
- package/lighthouse-core/fraggle-rock/gather/base-gatherer.js +6 -1
- package/lighthouse-core/gather/gatherers/dobetterweb/response-compression.js +1 -0
- package/lighthouse-core/lib/asset-saver.js +4 -1
- package/lighthouse-core/lib/lh-env.js +2 -0
- package/lighthouse-core/lib/tappable-rects.js +8 -15
- package/lighthouse-core/runner.js +1 -1
- package/lighthouse-core/util-commonjs.js +1 -2
- package/package.json +9 -6
- package/report/clients/standalone.js +0 -2
- package/report/renderer/element-screenshot-renderer.js +2 -2
- package/report/renderer/performance-category-renderer.js +20 -5
- package/report/renderer/util.js +1 -2
- package/report/test/renderer/performance-category-renderer-test.js +34 -8
- package/report/test/renderer/report-renderer-test.js +1 -1
- package/report/test/renderer/report-ui-features-test.js +3 -0
- package/report/test/renderer/util-test.js +13 -31
- package/shared/localization/format.js +9 -4
- package/shared/localization/locales/en-US.json +1 -1
- package/shared/localization/locales/en-XL.json +1 -1
- package/third-party/chromium-synchronization/installability-errors-test.js +2 -0
- package/types/lhr/flow.d.ts +3 -2
- package/types/rollup-plugin-postprocess.d.ts +10 -0
|
@@ -96,11 +96,23 @@ describe('PerfCategoryRenderer', () => {
|
|
|
96
96
|
assert.strictEqual(new URL(calcLink.href).hostname, 'googlechrome.github.io');
|
|
97
97
|
});
|
|
98
98
|
|
|
99
|
+
it('ignores hidden audits', () => {
|
|
100
|
+
const categoryDOM = renderer.render(category, sampleResults.categoryGroups);
|
|
101
|
+
|
|
102
|
+
const hiddenAudits = category.auditRefs.filter(audit => audit.group === 'hidden');
|
|
103
|
+
const auditElements = [...categoryDOM.querySelectorAll('.lh-audit')];
|
|
104
|
+
const matchingElements = auditElements
|
|
105
|
+
.filter(el => hiddenAudits.some(audit => audit.id === el.id));
|
|
106
|
+
expect(matchingElements).toHaveLength(0);
|
|
107
|
+
});
|
|
108
|
+
|
|
99
109
|
it('renders the failing performance opportunities', () => {
|
|
100
110
|
const categoryDOM = renderer.render(category, sampleResults.categoryGroups);
|
|
101
111
|
|
|
102
|
-
const oppAudits = category.auditRefs.filter(audit =>
|
|
103
|
-
|
|
112
|
+
const oppAudits = category.auditRefs.filter(audit =>
|
|
113
|
+
audit.result.details &&
|
|
114
|
+
audit.result.details.type === 'opportunity' &&
|
|
115
|
+
!Util.showAsPassed(audit.result));
|
|
104
116
|
const oppElements = [...categoryDOM.querySelectorAll('.lh-audit--load-opportunity')];
|
|
105
117
|
expect(oppElements.map(e => e.id).sort()).toEqual(oppAudits.map(a => a.id).sort());
|
|
106
118
|
expect(oppElements.length).toBeGreaterThan(0);
|
|
@@ -120,10 +132,14 @@ describe('PerfCategoryRenderer', () => {
|
|
|
120
132
|
it('renders performance opportunities with an errorMessage', () => {
|
|
121
133
|
const auditWithError = {
|
|
122
134
|
score: 0,
|
|
123
|
-
group: 'load-opportunities',
|
|
124
135
|
result: {
|
|
125
136
|
score: null, scoreDisplayMode: 'error', errorMessage: 'Yikes!!', title: 'Bug #2',
|
|
126
137
|
description: '',
|
|
138
|
+
details: {
|
|
139
|
+
overallSavingsMs: 0,
|
|
140
|
+
items: [],
|
|
141
|
+
type: 'opportunity',
|
|
142
|
+
},
|
|
127
143
|
},
|
|
128
144
|
};
|
|
129
145
|
|
|
@@ -137,10 +153,14 @@ describe('PerfCategoryRenderer', () => {
|
|
|
137
153
|
it('renders performance opportunities\' explanation', () => {
|
|
138
154
|
const auditWithExplanation = {
|
|
139
155
|
score: 0,
|
|
140
|
-
group: 'load-opportunities',
|
|
141
156
|
result: {
|
|
142
157
|
score: 0, scoreDisplayMode: 'numeric',
|
|
143
158
|
numericValue: 100, explanation: 'Yikes!!', title: 'Bug #2', description: '',
|
|
159
|
+
details: {
|
|
160
|
+
overallSavingsMs: 0,
|
|
161
|
+
items: [],
|
|
162
|
+
type: 'opportunity',
|
|
163
|
+
},
|
|
144
164
|
},
|
|
145
165
|
};
|
|
146
166
|
|
|
@@ -159,7 +179,9 @@ describe('PerfCategoryRenderer', () => {
|
|
|
159
179
|
'.lh-category > .lh-audit-group.lh-audit-group--diagnostics');
|
|
160
180
|
|
|
161
181
|
const diagnosticAuditIds = category.auditRefs.filter(audit => {
|
|
162
|
-
return audit.group
|
|
182
|
+
return !audit.group &&
|
|
183
|
+
!(audit.result.details && audit.result.details.type === 'opportunity') &&
|
|
184
|
+
!Util.showAsPassed(audit.result);
|
|
163
185
|
}).map(audit => audit.id).sort();
|
|
164
186
|
assert.ok(diagnosticAuditIds.length > 0);
|
|
165
187
|
|
|
@@ -173,8 +195,8 @@ describe('PerfCategoryRenderer', () => {
|
|
|
173
195
|
const passedSection = categoryDOM.querySelector('.lh-category > .lh-clump--passed');
|
|
174
196
|
|
|
175
197
|
const passedAudits = category.auditRefs.filter(audit =>
|
|
176
|
-
audit.group &&
|
|
177
|
-
|
|
198
|
+
!audit.group &&
|
|
199
|
+
Util.showAsPassed(audit.result));
|
|
178
200
|
const passedElements = passedSection.querySelectorAll('.lh-audit');
|
|
179
201
|
assert.equal(passedElements.length, passedAudits.length);
|
|
180
202
|
});
|
|
@@ -187,10 +209,14 @@ describe('PerfCategoryRenderer', () => {
|
|
|
187
209
|
it('handles erroring opportunities', () => {
|
|
188
210
|
const auditWithDebug = {
|
|
189
211
|
score: 0,
|
|
190
|
-
group: 'load-opportunities',
|
|
191
212
|
result: {
|
|
192
213
|
error: true, score: 0,
|
|
193
214
|
numericValue: 100, explanation: 'Yikes!!', title: 'Bug #2',
|
|
215
|
+
details: {
|
|
216
|
+
overallSavingsMs: 0,
|
|
217
|
+
items: [],
|
|
218
|
+
type: 'opportunity',
|
|
219
|
+
},
|
|
194
220
|
},
|
|
195
221
|
};
|
|
196
222
|
const wastedMs = renderer._getWastedMs(auditWithDebug);
|
|
@@ -90,7 +90,7 @@ describe('ReportRenderer', () => {
|
|
|
90
90
|
const output = renderer.renderReport(sampleResultsCopy, container);
|
|
91
91
|
|
|
92
92
|
function isPWAGauge(el) {
|
|
93
|
-
return el.querySelector('.lh-gauge__label').textContent === '
|
|
93
|
+
return el.querySelector('.lh-gauge__label').textContent === 'PWA';
|
|
94
94
|
}
|
|
95
95
|
function isPluginGauge(el) {
|
|
96
96
|
return el.querySelector('.lh-gauge__label').textContent === 'Some Plugin';
|
|
@@ -515,6 +515,9 @@ describe('ReportUIFeatures', () => {
|
|
|
515
515
|
expect(render(lhr).querySelector('.lh-button.lh-report-icon--treemap')).toBeTruthy();
|
|
516
516
|
|
|
517
517
|
delete lhr.audits['script-treemap-data'];
|
|
518
|
+
const newAuditRefs = lhr.categories['performance'].auditRefs
|
|
519
|
+
.filter(a => a.id !== 'script-treemap-data');
|
|
520
|
+
lhr.categories['performance'].auditRefs = newAuditRefs;
|
|
518
521
|
expect(render(lhr).querySelector('.lh-button.lh-report-icon--treemap')).toBeNull();
|
|
519
522
|
});
|
|
520
523
|
});
|
|
@@ -401,10 +401,10 @@ describe('util helpers', () => {
|
|
|
401
401
|
const category = {
|
|
402
402
|
id: 'performance',
|
|
403
403
|
auditRefs: [
|
|
404
|
-
{weight: 3, result: {score: 1, scoreDisplayMode: 'binary'}, group: '
|
|
405
|
-
{weight: 2, result: {score: 1, scoreDisplayMode: 'binary'}, group: '
|
|
406
|
-
{weight: 0, result: {score: 1, scoreDisplayMode: 'binary'}, group: '
|
|
407
|
-
{weight: 1, result: {score: 0, scoreDisplayMode: 'binary'}, group: '
|
|
404
|
+
{weight: 3, result: {score: 1, scoreDisplayMode: 'binary'}, group: 'metrics'},
|
|
405
|
+
{weight: 2, result: {score: 1, scoreDisplayMode: 'binary'}, group: 'metrics'},
|
|
406
|
+
{weight: 0, result: {score: 1, scoreDisplayMode: 'binary'}, group: 'metrics'},
|
|
407
|
+
{weight: 1, result: {score: 0, scoreDisplayMode: 'binary'}, group: 'metrics'},
|
|
408
408
|
],
|
|
409
409
|
};
|
|
410
410
|
const fraction = Util.calculateCategoryFraction(category);
|
|
@@ -416,14 +416,14 @@ describe('util helpers', () => {
|
|
|
416
416
|
});
|
|
417
417
|
});
|
|
418
418
|
|
|
419
|
-
it('ignores manual audits, N/A audits, and
|
|
419
|
+
it('ignores manual audits, N/A audits, and hidden audits', () => {
|
|
420
420
|
const category = {
|
|
421
421
|
id: 'performance',
|
|
422
422
|
auditRefs: [
|
|
423
|
-
{weight: 1, result: {score: 1, scoreDisplayMode: 'binary'}, group: '
|
|
424
|
-
{weight: 1, result: {score: 1, scoreDisplayMode: 'binary'}},
|
|
425
|
-
{weight: 1, result: {score: 0, scoreDisplayMode: 'manual'}, group: '
|
|
426
|
-
{weight: 1, result: {score: 0, scoreDisplayMode: 'notApplicable'}, group: '
|
|
423
|
+
{weight: 1, result: {score: 1, scoreDisplayMode: 'binary'}, group: 'metrics'},
|
|
424
|
+
{weight: 1, result: {score: 1, scoreDisplayMode: 'binary'}, group: 'hidden'},
|
|
425
|
+
{weight: 1, result: {score: 0, scoreDisplayMode: 'manual'}, group: 'metrics'},
|
|
426
|
+
{weight: 1, result: {score: 0, scoreDisplayMode: 'notApplicable'}, group: 'metrics'},
|
|
427
427
|
],
|
|
428
428
|
};
|
|
429
429
|
const fraction = Util.calculateCategoryFraction(category);
|
|
@@ -435,32 +435,14 @@ describe('util helpers', () => {
|
|
|
435
435
|
});
|
|
436
436
|
});
|
|
437
437
|
|
|
438
|
-
it('does not ignore audits with no group in non-performance category', () => {
|
|
439
|
-
const category = {
|
|
440
|
-
id: 'seo',
|
|
441
|
-
auditRefs: [
|
|
442
|
-
{weight: 1, result: {score: 1, scoreDisplayMode: 'binary'}, group: 'diagnostics'},
|
|
443
|
-
{weight: 1, result: {score: 1, scoreDisplayMode: 'binary'}},
|
|
444
|
-
{weight: 1, result: {score: 0, scoreDisplayMode: 'manual'}, group: 'diagnostics'},
|
|
445
|
-
],
|
|
446
|
-
};
|
|
447
|
-
const fraction = Util.calculateCategoryFraction(category);
|
|
448
|
-
expect(fraction).toEqual({
|
|
449
|
-
numPassableAudits: 2,
|
|
450
|
-
numPassed: 2,
|
|
451
|
-
numInformative: 0,
|
|
452
|
-
totalWeight: 2,
|
|
453
|
-
});
|
|
454
|
-
});
|
|
455
|
-
|
|
456
438
|
it('tracks informative audits separately', () => {
|
|
457
439
|
const category = {
|
|
458
440
|
id: 'performance',
|
|
459
441
|
auditRefs: [
|
|
460
|
-
{weight: 1, result: {score: 1, scoreDisplayMode: 'binary'}, group: '
|
|
461
|
-
{weight: 1, result: {score: 1, scoreDisplayMode: 'binary'}, group: '
|
|
462
|
-
{weight: 0, result: {score: 1, scoreDisplayMode: 'informative'}, group: '
|
|
463
|
-
{weight: 1, result: {score: 0, scoreDisplayMode: 'informative'}, group: '
|
|
442
|
+
{weight: 1, result: {score: 1, scoreDisplayMode: 'binary'}, group: 'metrics'},
|
|
443
|
+
{weight: 1, result: {score: 1, scoreDisplayMode: 'binary'}, group: 'metrics'},
|
|
444
|
+
{weight: 0, result: {score: 1, scoreDisplayMode: 'informative'}, group: 'metrics'},
|
|
445
|
+
{weight: 1, result: {score: 0, scoreDisplayMode: 'informative'}, group: 'metrics'},
|
|
464
446
|
],
|
|
465
447
|
};
|
|
466
448
|
const fraction = Util.calculateCategoryFraction(category);
|
|
@@ -7,11 +7,13 @@
|
|
|
7
7
|
|
|
8
8
|
const fs = require('fs');
|
|
9
9
|
|
|
10
|
-
const MessageFormat = require('intl-messageformat')
|
|
10
|
+
const MessageFormat = require('intl-messageformat');
|
|
11
11
|
const {isObjectOfUnknownValues, isObjectOrArrayOfUnknownValues} = require('../type-verifiers.js');
|
|
12
12
|
|
|
13
13
|
/** Contains available locales with messages. May be an empty object if bundled. */
|
|
14
|
-
|
|
14
|
+
/** @type {import('./locales')} */
|
|
15
|
+
// @ts-expect-error TODO(esmodules): remove when file is es modules.
|
|
16
|
+
const LOCALE_MESSAGES = require('./locales.js').default || require('./locales.js');
|
|
15
17
|
|
|
16
18
|
const DEFAULT_LOCALE = 'en-US';
|
|
17
19
|
|
|
@@ -93,7 +95,7 @@ function collectAllCustomElementsFromICU(icuElements, seenElementsById = new Map
|
|
|
93
95
|
* Returns a copy of the `values` object, with the values formatted based on how
|
|
94
96
|
* they will be used in their icuMessage, e.g. KB or milliseconds. The original
|
|
95
97
|
* object is unchanged.
|
|
96
|
-
* @param {MessageFormat} messageFormatter
|
|
98
|
+
* @param {MessageFormat.IntlMessageFormat} messageFormatter
|
|
97
99
|
* @param {Readonly<Record<string, string | number>>} values
|
|
98
100
|
* @param {string} lhlMessage Used for clear error logging.
|
|
99
101
|
* @return {Record<string, string | number>}
|
|
@@ -171,7 +173,10 @@ function formatMessage(message, values = {}, locale) {
|
|
|
171
173
|
// When using accented english, force the use of a different locale for number formatting.
|
|
172
174
|
const localeForMessageFormat = (locale === 'en-XA' || locale === 'en-XL') ? 'de-DE' : locale;
|
|
173
175
|
|
|
174
|
-
|
|
176
|
+
// This package is not correctly bundled by Rollup.
|
|
177
|
+
/** @type {typeof MessageFormat.IntlMessageFormat} */
|
|
178
|
+
const MessageFormatCtor = MessageFormat.IntlMessageFormat || MessageFormat;
|
|
179
|
+
const formatter = new MessageFormatCtor(message, localeForMessageFormat, formats);
|
|
175
180
|
|
|
176
181
|
// Preformat values for the message format like KB and milliseconds.
|
|
177
182
|
const valuesForMessageFormat = _preformatValues(formatter, values, message);
|
|
@@ -1776,7 +1776,7 @@
|
|
|
1776
1776
|
"message": "These checks are required by the baseline [PWA Checklist](https://developers.google.com/web/progressive-web-apps/checklist) but are not automatically checked by Lighthouse. They do not affect your score but it's important that you verify them manually."
|
|
1777
1777
|
},
|
|
1778
1778
|
"lighthouse-core/config/default-config.js | pwaCategoryTitle": {
|
|
1779
|
-
"message": "
|
|
1779
|
+
"message": "PWA"
|
|
1780
1780
|
},
|
|
1781
1781
|
"lighthouse-core/config/default-config.js | pwaInstallableGroupTitle": {
|
|
1782
1782
|
"message": "Installable"
|
|
@@ -1776,7 +1776,7 @@
|
|
|
1776
1776
|
"message": "T̂h́êśê ćĥéĉḱŝ ár̂é r̂éq̂úîŕêd́ b̂ý t̂h́ê b́âśêĺîńê [ṔŴÁ Ĉh́êćk̂ĺîśt̂](https://developers.google.com/web/progressive-web-apps/checklist) b́ût́ âŕê ńôt́ âút̂óm̂át̂íĉál̂ĺŷ ćĥéĉḱêd́ b̂ý L̂íĝh́t̂h́ôúŝé. T̂h́êý d̂ó n̂ót̂ áf̂f́êćt̂ ýôúr̂ śĉór̂é b̂út̂ ít̂'ś îḿp̂ór̂t́âńt̂ t́ĥát̂ ýôú v̂ér̂íf̂ý t̂h́êḿ m̂án̂úâĺl̂ý."
|
|
1777
1777
|
},
|
|
1778
1778
|
"lighthouse-core/config/default-config.js | pwaCategoryTitle": {
|
|
1779
|
-
"message": "P̂
|
|
1779
|
+
"message": "P̂ẂÂ"
|
|
1780
1780
|
},
|
|
1781
1781
|
"lighthouse-core/config/default-config.js | pwaInstallableGroupTitle": {
|
|
1782
1782
|
"message": "Îńŝt́âĺl̂áb̂ĺê"
|
package/types/lhr/flow.d.ts
CHANGED
|
@@ -0,0 +1,10 @@
|
|
|
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
|
+
declare module '@stadtlandnetz/rollup-plugin-postprocess' {
|
|
8
|
+
function postprocess(args: Array<[RegExp, string]>): void;
|
|
9
|
+
export = postprocess;
|
|
10
|
+
}
|