lighthouse 9.5.0-dev.20220505 → 9.5.0-dev.20220506
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/lighthouse-cli/test/smokehouse/version-check-test.js +0 -2
- package/lighthouse-core/audits/bootup-time.js +2 -70
- package/lighthouse-core/audits/long-tasks.js +3 -3
- package/lighthouse-core/audits/metrics/experimental-interaction-to-next-paint.js +7 -5
- package/lighthouse-core/audits/third-party-summary.js +3 -3
- package/lighthouse-core/computed/metrics/responsiveness.js +14 -13
- package/lighthouse-core/lib/cdt/generated/SourceMap.js +1 -1
- package/lighthouse-core/lib/tracehouse/task-summary.js +87 -0
- package/package.json +3 -3
- package/report/test/.eslintrc.cjs +11 -0
- package/report/test/clients/bundle-test.js +0 -3
- package/report/test/generator/file-namer-test.js +0 -1
- package/report/test/generator/report-generator-test.js +0 -2
- package/report/test/renderer/category-renderer-test.js +0 -2
- package/report/test/renderer/components-test.js +0 -2
- package/report/test/renderer/crc-details-renderer-test.js +0 -2
- package/report/test/renderer/details-renderer-test.js +0 -2
- package/report/test/renderer/dom-test.js +0 -2
- package/report/test/renderer/element-screenshot-renderer-test.js +0 -2
- package/report/test/renderer/i18n-test.js +0 -2
- package/report/test/renderer/performance-category-renderer-test.js +0 -2
- package/report/test/renderer/pwa-category-renderer-test.js +0 -2
- package/report/test/renderer/report-renderer-axe-test.js +0 -2
- package/report/test/renderer/report-renderer-test.js +0 -2
- package/report/test/renderer/report-ui-features-test.js +0 -2
- package/report/test/renderer/snippet-renderer-test.js +0 -2
- package/report/test/renderer/text-encoding-test.js +0 -2
- package/report/test/renderer/util-test.js +0 -2
- package/shared/test/localization/.eslintrc.cjs +11 -0
- package/shared/test/localization/format-test.js +0 -2
- package/shared/test/localization/locales-test.js +0 -2
- package/shared/test/localization/swap-locale-test.js +0 -2
- package/third-party/chromium-synchronization/inspector-issueAdded-types-test.js +0 -2
- package/third-party/chromium-synchronization/installability-errors-test.js +0 -2
- package/tsconfig.json +2 -0
- package/types/artifacts.d.ts +17 -0
|
@@ -6,11 +6,11 @@
|
|
|
6
6
|
'use strict';
|
|
7
7
|
|
|
8
8
|
const Audit = require('./audit.js');
|
|
9
|
-
const NetworkRequest = require('../lib/network-request.js');
|
|
10
9
|
const {taskGroups} = require('../lib/tracehouse/task-groups.js');
|
|
11
10
|
const i18n = require('../lib/i18n/i18n.js');
|
|
12
11
|
const NetworkRecords = require('../computed/network-records.js');
|
|
13
12
|
const MainThreadTasks = require('../computed/main-thread-tasks.js');
|
|
13
|
+
const {getExecutionTimingsByURL} = require('../lib/tracehouse/task-summary.js');
|
|
14
14
|
|
|
15
15
|
const UIStrings = {
|
|
16
16
|
/** Title of a diagnostic audit that provides detail on the time spent executing javascript files during the load. This descriptive title is shown to users when the amount is acceptable and no user action is required. */
|
|
@@ -34,18 +34,6 @@ const UIStrings = {
|
|
|
34
34
|
|
|
35
35
|
const str_ = i18n.createMessageInstanceIdFn(__filename, UIStrings);
|
|
36
36
|
|
|
37
|
-
// These trace events, when not triggered by a script inside a particular task, are just general Chrome overhead.
|
|
38
|
-
const BROWSER_TASK_NAMES_SET = new Set([
|
|
39
|
-
'CpuProfiler::StartProfiling',
|
|
40
|
-
]);
|
|
41
|
-
|
|
42
|
-
// These trace events, when not triggered by a script inside a particular task, are GC Chrome overhead.
|
|
43
|
-
const BROWSER_GC_TASK_NAMES_SET = new Set([
|
|
44
|
-
'V8.GCCompactor',
|
|
45
|
-
'MajorGC',
|
|
46
|
-
'MinorGC',
|
|
47
|
-
]);
|
|
48
|
-
|
|
49
37
|
class BootupTime extends Audit {
|
|
50
38
|
/**
|
|
51
39
|
* @return {LH.Audit.Meta}
|
|
@@ -74,61 +62,6 @@ class BootupTime extends Audit {
|
|
|
74
62
|
};
|
|
75
63
|
}
|
|
76
64
|
|
|
77
|
-
/**
|
|
78
|
-
* @param {LH.Artifacts.NetworkRequest[]} records
|
|
79
|
-
*/
|
|
80
|
-
static getJavaScriptURLs(records) {
|
|
81
|
-
/** @type {Set<string>} */
|
|
82
|
-
const urls = new Set();
|
|
83
|
-
for (const record of records) {
|
|
84
|
-
if (record.resourceType === NetworkRequest.TYPES.Script) {
|
|
85
|
-
urls.add(record.url);
|
|
86
|
-
}
|
|
87
|
-
}
|
|
88
|
-
|
|
89
|
-
return urls;
|
|
90
|
-
}
|
|
91
|
-
|
|
92
|
-
/**
|
|
93
|
-
* @param {LH.Artifacts.TaskNode} task
|
|
94
|
-
* @param {Set<string>} jsURLs
|
|
95
|
-
* @return {string}
|
|
96
|
-
*/
|
|
97
|
-
static getAttributableURLForTask(task, jsURLs) {
|
|
98
|
-
const jsURL = task.attributableURLs.find(url => jsURLs.has(url));
|
|
99
|
-
const fallbackURL = task.attributableURLs[0];
|
|
100
|
-
let attributableURL = jsURL || fallbackURL;
|
|
101
|
-
// If we can't find what URL was responsible for this execution, attribute it to the root page
|
|
102
|
-
// or Chrome depending on the type of work.
|
|
103
|
-
if (!attributableURL || attributableURL === 'about:blank') {
|
|
104
|
-
if (BROWSER_TASK_NAMES_SET.has(task.event.name)) attributableURL = 'Browser';
|
|
105
|
-
else if (BROWSER_GC_TASK_NAMES_SET.has(task.event.name)) attributableURL = 'Browser GC';
|
|
106
|
-
else attributableURL = 'Unattributable';
|
|
107
|
-
}
|
|
108
|
-
|
|
109
|
-
return attributableURL;
|
|
110
|
-
}
|
|
111
|
-
|
|
112
|
-
/**
|
|
113
|
-
* @param {LH.Artifacts.TaskNode[]} tasks
|
|
114
|
-
* @param {Set<string>} jsURLs
|
|
115
|
-
* @return {Map<string, Object<string, number>>}
|
|
116
|
-
*/
|
|
117
|
-
static getExecutionTimingsByURL(tasks, jsURLs) {
|
|
118
|
-
/** @type {Map<string, Object<string, number>>} */
|
|
119
|
-
const result = new Map();
|
|
120
|
-
|
|
121
|
-
for (const task of tasks) {
|
|
122
|
-
const attributableURL = BootupTime.getAttributableURLForTask(task, jsURLs);
|
|
123
|
-
const timingByGroupId = result.get(attributableURL) || {};
|
|
124
|
-
const originalTime = timingByGroupId[task.group.id] || 0;
|
|
125
|
-
timingByGroupId[task.group.id] = originalTime + task.selfTime;
|
|
126
|
-
result.set(attributableURL, timingByGroupId);
|
|
127
|
-
}
|
|
128
|
-
|
|
129
|
-
return result;
|
|
130
|
-
}
|
|
131
|
-
|
|
132
65
|
/**
|
|
133
66
|
* @param {LH.Artifacts} artifacts
|
|
134
67
|
* @param {LH.Audit.Context} context
|
|
@@ -143,8 +76,7 @@ class BootupTime extends Audit {
|
|
|
143
76
|
const multiplier = settings.throttlingMethod === 'simulate' ?
|
|
144
77
|
settings.throttling.cpuSlowdownMultiplier : 1;
|
|
145
78
|
|
|
146
|
-
const
|
|
147
|
-
const executionTimings = BootupTime.getExecutionTimingsByURL(tasks, jsURLs);
|
|
79
|
+
const executionTimings = getExecutionTimingsByURL(tasks, networkRecords);
|
|
148
80
|
|
|
149
81
|
let hadExcessiveChromeExtension = false;
|
|
150
82
|
let totalBootupTime = 0;
|
|
@@ -9,9 +9,9 @@ const Audit = require('./audit.js');
|
|
|
9
9
|
const NetworkRecords = require('../computed/network-records.js');
|
|
10
10
|
const i18n = require('../lib/i18n/i18n.js');
|
|
11
11
|
const MainThreadTasks = require('../computed/main-thread-tasks.js');
|
|
12
|
-
const BootupTime = require('./bootup-time.js');
|
|
13
12
|
const PageDependencyGraph = require('../computed/page-dependency-graph.js');
|
|
14
13
|
const LoadSimulator = require('../computed/load-simulator.js');
|
|
14
|
+
const {getJavaScriptURLs, getAttributableURLForTask} = require('../lib/tracehouse/task-summary.js');
|
|
15
15
|
|
|
16
16
|
/** We don't always have timing data for short tasks, if we're missing timing data. Treat it as though it were 0ms. */
|
|
17
17
|
const DEFAULT_TIMING = {startTime: 0, endTime: 0, duration: 0};
|
|
@@ -78,7 +78,7 @@ class LongTasks extends Audit {
|
|
|
78
78
|
}
|
|
79
79
|
}
|
|
80
80
|
|
|
81
|
-
const jsURLs =
|
|
81
|
+
const jsURLs = getJavaScriptURLs(networkRecords);
|
|
82
82
|
// Only consider up to 20 long, top-level (no parent) tasks that have an explicit endTime
|
|
83
83
|
const longtasks = tasks
|
|
84
84
|
.map(t => {
|
|
@@ -91,7 +91,7 @@ class LongTasks extends Audit {
|
|
|
91
91
|
|
|
92
92
|
// TODO(beytoven): Add start time that matches with the simulated throttling
|
|
93
93
|
const results = longtasks.map(task => ({
|
|
94
|
-
url:
|
|
94
|
+
url: getAttributableURLForTask(task, jsURLs),
|
|
95
95
|
duration: task.duration,
|
|
96
96
|
startTime: task.startTime,
|
|
97
97
|
}));
|
|
@@ -63,19 +63,21 @@ class ExperimentalInteractionToNextPaint extends Audit {
|
|
|
63
63
|
|
|
64
64
|
const trace = artifacts.traces[Audit.DEFAULT_PASS];
|
|
65
65
|
const metricData = {trace, settings};
|
|
66
|
-
const
|
|
66
|
+
const responsivenessEvent = await ComputedResponsivenes.request(metricData, context);
|
|
67
67
|
|
|
68
68
|
// TODO: include the no-interaction state in the report instead of using n/a.
|
|
69
|
-
if (
|
|
69
|
+
if (responsivenessEvent === null) {
|
|
70
70
|
return {score: null, notApplicable: true};
|
|
71
71
|
}
|
|
72
72
|
|
|
73
|
+
const timing = responsivenessEvent.args.data.maxDuration;
|
|
74
|
+
|
|
73
75
|
return {
|
|
74
76
|
score: Audit.computeLogNormalScore({p10: context.options.p10, median: context.options.median},
|
|
75
|
-
|
|
76
|
-
numericValue:
|
|
77
|
+
timing),
|
|
78
|
+
numericValue: timing,
|
|
77
79
|
numericUnit: 'millisecond',
|
|
78
|
-
displayValue: str_(i18n.UIStrings.ms, {timeInMs:
|
|
80
|
+
displayValue: str_(i18n.UIStrings.ms, {timeInMs: timing}),
|
|
79
81
|
};
|
|
80
82
|
}
|
|
81
83
|
}
|
|
@@ -6,11 +6,11 @@
|
|
|
6
6
|
'use strict';
|
|
7
7
|
|
|
8
8
|
const Audit = require('./audit.js');
|
|
9
|
-
const BootupTime = require('./bootup-time.js');
|
|
10
9
|
const i18n = require('../lib/i18n/i18n.js');
|
|
11
10
|
const thirdPartyWeb = require('../lib/third-party-web.js');
|
|
12
11
|
const NetworkRecords = require('../computed/network-records.js');
|
|
13
12
|
const MainThreadTasks = require('../computed/main-thread-tasks.js');
|
|
13
|
+
const {getJavaScriptURLs, getAttributableURLForTask} = require('../lib/tracehouse/task-summary.js');
|
|
14
14
|
|
|
15
15
|
const UIStrings = {
|
|
16
16
|
/** Title of a diagnostic audit that provides details about the code on a web page that the user doesn't control (referred to as "third-party code"). This descriptive title is shown to users when the amount is acceptable and no user action is required. */
|
|
@@ -98,10 +98,10 @@ class ThirdPartySummary extends Audit {
|
|
|
98
98
|
byURL.set(request.url, urlSummary);
|
|
99
99
|
}
|
|
100
100
|
|
|
101
|
-
const jsURLs =
|
|
101
|
+
const jsURLs = getJavaScriptURLs(networkRecords);
|
|
102
102
|
|
|
103
103
|
for (const task of mainThreadTasks) {
|
|
104
|
-
const attributableURL =
|
|
104
|
+
const attributableURL = getAttributableURLForTask(task, jsURLs);
|
|
105
105
|
|
|
106
106
|
const urlSummary = byURL.get(attributableURL) || {...defaultSummary};
|
|
107
107
|
const taskDuration = task.selfTime * cpuMultiplier;
|
|
@@ -11,24 +11,25 @@
|
|
|
11
11
|
* user input in the provided trace).
|
|
12
12
|
*/
|
|
13
13
|
|
|
14
|
+
/** @typedef {LH.Trace.CompleteEvent & {name: 'Responsiveness.Renderer.UserInteraction', args: {frame: string, data: {interactionType: 'drag'|'keyboard'|'tapOrClick', maxDuration: number}}}} ResponsivenessEvent */
|
|
15
|
+
|
|
14
16
|
const makeComputedArtifact = require('../computed-artifact.js');
|
|
15
17
|
const ProcessedTrace = require('../processed-trace.js');
|
|
16
18
|
|
|
17
19
|
class Responsiveness {
|
|
18
20
|
/**
|
|
19
21
|
* @param {LH.Artifacts.ProcessedTrace} processedTrace
|
|
20
|
-
* @return {
|
|
22
|
+
* @return {ResponsivenessEvent|null}
|
|
21
23
|
*/
|
|
22
24
|
static getHighPercentileResponsiveness(processedTrace) {
|
|
23
|
-
const
|
|
25
|
+
const responsivenessEvents = processedTrace.frameTreeEvents
|
|
24
26
|
// https://source.chromium.org/chromium/chromium/src/+/main:third_party/blink/renderer/core/timing/responsiveness_metrics.cc;l=146-150;drc=a1a2302f30b0a58f7669a41c80acdf1fa11958dd
|
|
25
|
-
.filter(e
|
|
26
|
-
|
|
27
|
-
.
|
|
28
|
-
.sort((a, b) => b - a);
|
|
27
|
+
.filter(/** @return {e is ResponsivenessEvent} */ e => {
|
|
28
|
+
return e.name === 'Responsiveness.Renderer.UserInteraction';
|
|
29
|
+
}).sort((a, b) => b.args.data.maxDuration - a.args.data.maxDuration);
|
|
29
30
|
|
|
30
31
|
// If there were no interactions with the page, the metric is N/A.
|
|
31
|
-
if (
|
|
32
|
+
if (responsivenessEvents.length === 0) {
|
|
32
33
|
return null;
|
|
33
34
|
}
|
|
34
35
|
|
|
@@ -36,17 +37,15 @@ class Responsiveness {
|
|
|
36
37
|
// keeps the 10 worst events around, so it can never be more than the 10th from
|
|
37
38
|
// last array element. To keep things simpler, sort desc and pick from front.
|
|
38
39
|
// See https://source.chromium.org/chromium/chromium/src/+/main:components/page_load_metrics/browser/responsiveness_metrics_normalization.cc;l=45-59;drc=cb0f9c8b559d9c7c3cb4ca94fc1118cc015d38ad
|
|
39
|
-
const index = Math.min(9, Math.floor(
|
|
40
|
+
const index = Math.min(9, Math.floor(responsivenessEvents.length / 50));
|
|
40
41
|
|
|
41
|
-
return
|
|
42
|
-
timing: durations[index],
|
|
43
|
-
};
|
|
42
|
+
return responsivenessEvents[index];
|
|
44
43
|
}
|
|
45
44
|
|
|
46
45
|
/**
|
|
47
46
|
* @param {{trace: LH.Trace, settings: Immutable<LH.Config.Settings>}} data
|
|
48
47
|
* @param {LH.Artifacts.ComputedContext} context
|
|
49
|
-
* @return {Promise<
|
|
48
|
+
* @return {Promise<ResponsivenessEvent|null>}
|
|
50
49
|
*/
|
|
51
50
|
static async compute_(data, context) {
|
|
52
51
|
if (data.settings.throttlingMethod === 'simulate') {
|
|
@@ -54,7 +53,9 @@ class Responsiveness {
|
|
|
54
53
|
}
|
|
55
54
|
|
|
56
55
|
const processedTrace = await ProcessedTrace.request(data.trace, context);
|
|
57
|
-
|
|
56
|
+
const event = Responsiveness.getHighPercentileResponsiveness(processedTrace);
|
|
57
|
+
|
|
58
|
+
return JSON.parse(JSON.stringify(event));
|
|
58
59
|
}
|
|
59
60
|
}
|
|
60
61
|
|
|
@@ -149,7 +149,7 @@ class TextSourceMap {
|
|
|
149
149
|
}
|
|
150
150
|
return mappings.slice(startIndex, endIndex);
|
|
151
151
|
}
|
|
152
|
-
/** @return {Array<{lineNumber: number, columnNumber: number, sourceURL?: string, sourceLineNumber, sourceColumnNumber: number, name?: string, lastColumnNumber?: number}>} */
|
|
152
|
+
/** @return {Array<{lineNumber: number, columnNumber: number, sourceURL?: string, sourceLineNumber: number, sourceColumnNumber: number, name?: string, lastColumnNumber?: number}>} */
|
|
153
153
|
mappings() {
|
|
154
154
|
if (this.mappingsInternal === null) {
|
|
155
155
|
this.mappingsInternal = [];
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license Copyright 2022 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
|
+
/**
|
|
9
|
+
* @fileoverview Utility functions for grouping and summarizing tasks.
|
|
10
|
+
*/
|
|
11
|
+
|
|
12
|
+
const NetworkRequest = require('../network-request.js');
|
|
13
|
+
|
|
14
|
+
// These trace events, when not triggered by a script inside a particular task, are just general Chrome overhead.
|
|
15
|
+
const BROWSER_TASK_NAMES_SET = new Set([
|
|
16
|
+
'CpuProfiler::StartProfiling',
|
|
17
|
+
]);
|
|
18
|
+
|
|
19
|
+
// These trace events, when not triggered by a script inside a particular task, are GC Chrome overhead.
|
|
20
|
+
const BROWSER_GC_TASK_NAMES_SET = new Set([
|
|
21
|
+
'V8.GCCompactor',
|
|
22
|
+
'MajorGC',
|
|
23
|
+
'MinorGC',
|
|
24
|
+
]);
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* @param {LH.Artifacts.NetworkRequest[]} records
|
|
28
|
+
*/
|
|
29
|
+
function getJavaScriptURLs(records) {
|
|
30
|
+
/** @type {Set<string>} */
|
|
31
|
+
const urls = new Set();
|
|
32
|
+
for (const record of records) {
|
|
33
|
+
if (record.resourceType === NetworkRequest.TYPES.Script) {
|
|
34
|
+
urls.add(record.url);
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
return urls;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
/**
|
|
42
|
+
* @param {LH.Artifacts.TaskNode} task
|
|
43
|
+
* @param {Set<string>} jsURLs
|
|
44
|
+
* @return {string}
|
|
45
|
+
*/
|
|
46
|
+
function getAttributableURLForTask(task, jsURLs) {
|
|
47
|
+
const jsURL = task.attributableURLs.find(url => jsURLs.has(url));
|
|
48
|
+
const fallbackURL = task.attributableURLs[0];
|
|
49
|
+
let attributableURL = jsURL || fallbackURL;
|
|
50
|
+
// If we can't find what URL was responsible for this execution, attribute it to the root page
|
|
51
|
+
// or Chrome depending on the type of work.
|
|
52
|
+
if (!attributableURL || attributableURL === 'about:blank') {
|
|
53
|
+
if (BROWSER_TASK_NAMES_SET.has(task.event.name)) attributableURL = 'Browser';
|
|
54
|
+
else if (BROWSER_GC_TASK_NAMES_SET.has(task.event.name)) attributableURL = 'Browser GC';
|
|
55
|
+
else attributableURL = 'Unattributable';
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
return attributableURL;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
/**
|
|
62
|
+
* @param {LH.Artifacts.TaskNode[]} tasks
|
|
63
|
+
* @param {Array<LH.Artifacts.NetworkRequest>} networkRecords
|
|
64
|
+
* @return {Map<string, Record<string, number>>}
|
|
65
|
+
*/
|
|
66
|
+
function getExecutionTimingsByURL(tasks, networkRecords) {
|
|
67
|
+
const jsURLs = getJavaScriptURLs(networkRecords);
|
|
68
|
+
|
|
69
|
+
/** @type {Map<string, Record<string, number>>} */
|
|
70
|
+
const result = new Map();
|
|
71
|
+
|
|
72
|
+
for (const task of tasks) {
|
|
73
|
+
const attributableURL = getAttributableURLForTask(task, jsURLs);
|
|
74
|
+
const timingByGroupId = result.get(attributableURL) || {};
|
|
75
|
+
const originalTime = timingByGroupId[task.group.id] || 0;
|
|
76
|
+
timingByGroupId[task.group.id] = originalTime + task.selfTime;
|
|
77
|
+
result.set(attributableURL, timingByGroupId);
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
return result;
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
module.exports = {
|
|
84
|
+
getJavaScriptURLs,
|
|
85
|
+
getAttributableURLForTask,
|
|
86
|
+
getExecutionTimingsByURL,
|
|
87
|
+
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "lighthouse",
|
|
3
|
-
"version": "9.5.0-dev.
|
|
3
|
+
"version": "9.5.0-dev.20220506",
|
|
4
4
|
"description": "Automated auditing, performance metrics, and best practices for the web.",
|
|
5
5
|
"main": "./lighthouse-core/index.js",
|
|
6
6
|
"bin": {
|
|
@@ -68,13 +68,13 @@
|
|
|
68
68
|
"vercel-build": "yarn build-sample-reports && yarn build-viewer && yarn build-treemap",
|
|
69
69
|
"dogfood-lhci": "./lighthouse-core/scripts/dogfood-lhci.sh",
|
|
70
70
|
"timing-trace": "node lighthouse-core/scripts/generate-timing-trace.js",
|
|
71
|
-
"changelog": "conventional-changelog --config ./build/changelog-generator/index.
|
|
71
|
+
"changelog": "conventional-changelog --config ./build/changelog-generator/index.cjs --infile changelog.md --same-file",
|
|
72
72
|
"type-check": "tsc --build ./tsconfig-all.json",
|
|
73
73
|
"i18n:checks": "./lighthouse-core/scripts/i18n/assert-strings-collected.sh",
|
|
74
74
|
"i18n:collect-strings": "node lighthouse-core/scripts/i18n/collect-strings.js",
|
|
75
75
|
"update:lantern-baseline": "node lighthouse-core/scripts/lantern/update-baseline-lantern-values.js",
|
|
76
76
|
"update:sample-artifacts": "node lighthouse-core/scripts/update-report-fixtures.js",
|
|
77
|
-
"update:sample-json": "yarn i18n:collect-strings && node ./lighthouse-cli -A=./lighthouse-core/test/results/artifacts --config-path=./lighthouse-core/test/results/sample-config.js --output=json --output-path=./lighthouse-core/test/results/sample_v2.json && node lighthouse-core/scripts/cleanup-LHR-for-diff.js ./lighthouse-core/test/results/sample_v2.json --only-remove-timing",
|
|
77
|
+
"update:sample-json": "yarn i18n:collect-strings && node ./lighthouse-cli -A=./lighthouse-core/test/results/artifacts --config-path=./lighthouse-core/test/results/sample-config.js --output=json --output-path=./lighthouse-core/test/results/sample_v2.json && node lighthouse-core/scripts/cleanup-LHR-for-diff.js ./lighthouse-core/test/results/sample_v2.json --only-remove-timing && node ./lighthouse-core/scripts/update-flow-fixtures.js",
|
|
78
78
|
"update:flow-sample-json": "yarn i18n:collect-strings && node ./lighthouse-core/scripts/update-flow-fixtures.js",
|
|
79
79
|
"update:test-devtools": "bash lighthouse-core/test/chromium-web-tests/test-locally.sh --reset-results",
|
|
80
80
|
"test-devtools": "bash lighthouse-core/test/chromium-web-tests/test-locally.sh",
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license Copyright 2022 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
|
+
module.exports = {
|
|
8
|
+
env: {
|
|
9
|
+
jest: true,
|
|
10
|
+
},
|
|
11
|
+
};
|
|
@@ -16,9 +16,6 @@ import {LH_ROOT} from '../../../root.js';
|
|
|
16
16
|
const sampleResultsStr =
|
|
17
17
|
fs.readFileSync(LH_ROOT + '/lighthouse-core/test/results/sample_v2.json', 'utf-8');
|
|
18
18
|
|
|
19
|
-
|
|
20
|
-
/* eslint-env jest */
|
|
21
|
-
|
|
22
19
|
describe('lighthouseRenderer bundle', () => {
|
|
23
20
|
let document;
|
|
24
21
|
beforeAll(() => {
|
|
@@ -9,7 +9,6 @@ const assert = require('assert').strict;
|
|
|
9
9
|
|
|
10
10
|
const getLhrFilenamePrefix = require('../../generator/file-namer.js').getLhrFilenamePrefix;
|
|
11
11
|
|
|
12
|
-
/* eslint-env jest */
|
|
13
12
|
describe('file-namer helper', () => {
|
|
14
13
|
it('generates filename prefixes', () => {
|
|
15
14
|
const results = {
|
|
@@ -15,8 +15,6 @@ const csvValidator = require('csv-validator');
|
|
|
15
15
|
const ReportGenerator = require('../../generator/report-generator.js');
|
|
16
16
|
const sampleResults = require('../../../lighthouse-core/test/results/sample_v2.json');
|
|
17
17
|
|
|
18
|
-
/* eslint-env jest */
|
|
19
|
-
|
|
20
18
|
describe('ReportGenerator', () => {
|
|
21
19
|
describe('#replaceStrings', () => {
|
|
22
20
|
it('should replace all occurrences', () => {
|
|
@@ -4,8 +4,6 @@
|
|
|
4
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
5
|
*/
|
|
6
6
|
|
|
7
|
-
/* eslint-env jest */
|
|
8
|
-
|
|
9
7
|
import {strict as assert} from 'assert';
|
|
10
8
|
|
|
11
9
|
import jsdom from 'jsdom';
|
|
@@ -4,8 +4,6 @@
|
|
|
4
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
5
|
*/
|
|
6
6
|
|
|
7
|
-
/* eslint-env jest */
|
|
8
|
-
|
|
9
7
|
import fs from 'fs';
|
|
10
8
|
|
|
11
9
|
import jsdom from 'jsdom';
|
|
@@ -4,8 +4,6 @@
|
|
|
4
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
5
|
*/
|
|
6
6
|
|
|
7
|
-
/* eslint-env jest */
|
|
8
|
-
|
|
9
7
|
import {strict as assert} from 'assert';
|
|
10
8
|
|
|
11
9
|
import jsdom from 'jsdom';
|
|
@@ -4,8 +4,6 @@
|
|
|
4
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
5
|
*/
|
|
6
6
|
|
|
7
|
-
/* eslint-env jest */
|
|
8
|
-
|
|
9
7
|
import jsdom from 'jsdom';
|
|
10
8
|
|
|
11
9
|
import {ElementScreenshotRenderer} from '../../renderer/element-screenshot-renderer.js';
|
|
@@ -4,8 +4,6 @@
|
|
|
4
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
5
|
*/
|
|
6
6
|
|
|
7
|
-
/* eslint-env jest */
|
|
8
|
-
|
|
9
7
|
import {strict as assert} from 'assert';
|
|
10
8
|
|
|
11
9
|
import jsdom from 'jsdom';
|
|
@@ -4,8 +4,6 @@
|
|
|
4
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
5
|
*/
|
|
6
6
|
|
|
7
|
-
/* eslint-env jest */
|
|
8
|
-
|
|
9
7
|
import {strict as assert} from 'assert';
|
|
10
8
|
|
|
11
9
|
import jsdom from 'jsdom';
|
|
@@ -4,8 +4,6 @@
|
|
|
4
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
5
|
*/
|
|
6
6
|
|
|
7
|
-
/* eslint-env jest */
|
|
8
|
-
|
|
9
7
|
import puppeteer from 'puppeteer';
|
|
10
8
|
|
|
11
9
|
import sampleResults from '../../../lighthouse-core/test/results/sample_v2.json';
|
|
@@ -4,8 +4,6 @@
|
|
|
4
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
5
|
*/
|
|
6
6
|
|
|
7
|
-
/* eslint-env jest */
|
|
8
|
-
|
|
9
7
|
import {strict as assert} from 'assert';
|
|
10
8
|
|
|
11
9
|
import jsdom from 'jsdom';
|
|
@@ -4,8 +4,6 @@
|
|
|
4
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
5
|
*/
|
|
6
6
|
|
|
7
|
-
/* eslint-env jest */
|
|
8
|
-
|
|
9
7
|
import {strict as assert} from 'assert';
|
|
10
8
|
|
|
11
9
|
import jsdom from 'jsdom';
|
|
@@ -4,8 +4,6 @@
|
|
|
4
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
5
|
*/
|
|
6
6
|
|
|
7
|
-
/* eslint-env jest */
|
|
8
|
-
|
|
9
7
|
import {strict as assert} from 'assert';
|
|
10
8
|
|
|
11
9
|
import jsdom from 'jsdom';
|
|
@@ -10,8 +10,6 @@ import {Util} from '../../renderer/util.js';
|
|
|
10
10
|
import {I18n} from '../../renderer/i18n.js';
|
|
11
11
|
import sampleResult from '../../../lighthouse-core/test/results/sample_v2.json';
|
|
12
12
|
|
|
13
|
-
/* eslint-env jest */
|
|
14
|
-
|
|
15
13
|
describe('util helpers', () => {
|
|
16
14
|
beforeEach(() => {
|
|
17
15
|
Util.i18n = new I18n('en', {...Util.UIStrings});
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license Copyright 2022 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
|
+
module.exports = {
|
|
8
|
+
env: {
|
|
9
|
+
jest: true,
|
|
10
|
+
},
|
|
11
|
+
};
|
|
@@ -12,8 +12,6 @@ const i18n = require('../../../lighthouse-core/lib/i18n/i18n.js');
|
|
|
12
12
|
const constants = require('../../../lighthouse-core/config/constants.js');
|
|
13
13
|
const locales = require('../../localization/locales.js');
|
|
14
14
|
|
|
15
|
-
/* eslint-env jest */
|
|
16
|
-
|
|
17
15
|
describe('format', () => {
|
|
18
16
|
describe('DEFAULT_LOCALE', () => {
|
|
19
17
|
it('is the same as the default config locale', () => {
|
|
@@ -8,8 +8,6 @@
|
|
|
8
8
|
const locales = require('../../localization/locales.js');
|
|
9
9
|
const assert = require('assert').strict;
|
|
10
10
|
|
|
11
|
-
/* eslint-env jest */
|
|
12
|
-
|
|
13
11
|
describe('locales', () => {
|
|
14
12
|
it('has only canonical (or expected-deprecated) language tags', () => {
|
|
15
13
|
// Map of deprecated codes to their canonical version. Depending on the ICU
|
|
@@ -8,8 +8,6 @@
|
|
|
8
8
|
const swapLocale = require('../../localization/swap-locale.js');
|
|
9
9
|
|
|
10
10
|
const lhr = require('../../../lighthouse-core/test/results/sample_v2.json');
|
|
11
|
-
|
|
12
|
-
/* eslint-env jest */
|
|
13
11
|
describe('swap-locale', () => {
|
|
14
12
|
it('does not mutate the original lhr', () => {
|
|
15
13
|
/** @type {LH.Result} */
|
|
@@ -13,8 +13,6 @@ const inspectorIssuesGathererPath = LH_ROOT +
|
|
|
13
13
|
'/lighthouse-core/gather/gatherers/inspector-issues.js';
|
|
14
14
|
const inspectorIssuesGathererSource = fs.readFileSync(inspectorIssuesGathererPath, 'utf-8');
|
|
15
15
|
|
|
16
|
-
/* eslint-env jest */
|
|
17
|
-
|
|
18
16
|
describe('issueAdded types', () => {
|
|
19
17
|
/** @type {Array<LH.Crdp.Audits.InspectorIssueDetails>} */
|
|
20
18
|
let inspectorIssueDetailsTypes;
|
package/tsconfig.json
CHANGED
|
@@ -11,6 +11,7 @@
|
|
|
11
11
|
{"path": "./report/"},
|
|
12
12
|
{"path": "./report/generator/"},
|
|
13
13
|
{"path": "./shared/"},
|
|
14
|
+
{"path": "./treemap/"},
|
|
14
15
|
],
|
|
15
16
|
"include": [
|
|
16
17
|
"root.js",
|
|
@@ -99,6 +100,7 @@
|
|
|
99
100
|
"lighthouse-core/test/lib/timing-trace-saver-test.js",
|
|
100
101
|
"lighthouse-core/test/lib/tracehouse/cpu-profile-model-test.js",
|
|
101
102
|
"lighthouse-core/test/lib/tracehouse/main-thread-tasks-test.js",
|
|
103
|
+
"lighthouse-core/test/lib/tracehouse/task-summary-test.js",
|
|
102
104
|
"lighthouse-core/test/lib/tracehouse/trace-processor-test.js",
|
|
103
105
|
"lighthouse-core/test/lib/traces/pwmetrics-events-test.js",
|
|
104
106
|
"lighthouse-core/test/lib/url-shim-test.js",
|
package/types/artifacts.d.ts
CHANGED
|
@@ -1020,6 +1020,23 @@ export interface TraceEvent {
|
|
|
1020
1020
|
};
|
|
1021
1021
|
}
|
|
1022
1022
|
|
|
1023
|
+
declare module Trace {
|
|
1024
|
+
/**
|
|
1025
|
+
* Base event of a `ph: 'X'` 'complete' event. Extend with `name` and `args` as
|
|
1026
|
+
* needed.
|
|
1027
|
+
*/
|
|
1028
|
+
interface CompleteEvent {
|
|
1029
|
+
ph: 'X';
|
|
1030
|
+
cat: string;
|
|
1031
|
+
pid: number;
|
|
1032
|
+
tid: number;
|
|
1033
|
+
dur: number;
|
|
1034
|
+
ts: number;
|
|
1035
|
+
tdur: number;
|
|
1036
|
+
tts: number;
|
|
1037
|
+
}
|
|
1038
|
+
}
|
|
1039
|
+
|
|
1023
1040
|
/**
|
|
1024
1041
|
* A record of DevTools Debugging Protocol events.
|
|
1025
1042
|
*/
|