lighthouse 12.0.0-dev.20240523 → 12.0.0-dev.20240525

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.
@@ -163,8 +163,18 @@ async function runSmokeTest(smokeTestDefn, testOptions) {
163
163
 
164
164
  // Run Lighthouse.
165
165
  try {
166
+ // Each individual runner has internal timeouts, but we've had bugs where
167
+ // that didn't cover some edge case. So to be safe give a (long) timeout here.
168
+ const timeoutPromise = new Promise((_, reject) => {
169
+ setTimeout(() =>
170
+ reject(new Error('Timed out waiting for provided lighthouseRunner')), 1000 * 120);
171
+ });
172
+ const timedResult = await Promise.race([
173
+ lighthouseRunner(requestedUrl, config, testRunnerOptions),
174
+ timeoutPromise,
175
+ ]);
166
176
  result = {
167
- ...await lighthouseRunner(requestedUrl, config, testRunnerOptions),
177
+ ...timedResult,
168
178
  networkRequests: takeNetworkRequestUrls ? takeNetworkRequestUrls() : undefined,
169
179
  };
170
180
 
@@ -1,6 +1,12 @@
1
1
  export { InteractiveComputed as Interactive };
2
2
  export type TimePeriod = {
3
+ /**
4
+ * In ms.
5
+ */
3
6
  start: number;
7
+ /**
8
+ * In ms.
9
+ */
4
10
  end: number;
5
11
  };
6
12
  declare const InteractiveComputed: typeof Interactive & {
@@ -187,6 +187,6 @@ export {InteractiveComputed as Interactive};
187
187
 
188
188
  /**
189
189
  * @typedef TimePeriod
190
- * @property {number} start
191
- * @property {number} end
190
+ * @property {number} start In ms.
191
+ * @property {number} end In ms.
192
192
  */
@@ -8,9 +8,10 @@ export class NetworkMonitor extends NetworkMonitor_base {
8
8
  /**
9
9
  * Finds all time periods where the number of inflight requests is less than or equal to the
10
10
  * number of allowed concurrent requests.
11
+ * The time periods returned are in ms.
11
12
  * @param {Array<LH.Artifacts.NetworkRequest>} requests
12
13
  * @param {number} allowedConcurrentRequests
13
- * @param {number=} endTime
14
+ * @param {number=} endTime In ms
14
15
  * @return {Array<{start: number, end: number}>}
15
16
  */
16
17
  static findNetworkQuietPeriods(requests: Array<LH.Artifacts.NetworkRequest>, allowedConcurrentRequests: number, endTime?: number | undefined): Array<{
@@ -202,9 +202,10 @@ class NetworkMonitor extends NetworkMonitorEventEmitter {
202
202
  /**
203
203
  * Finds all time periods where the number of inflight requests is less than or equal to the
204
204
  * number of allowed concurrent requests.
205
+ * The time periods returned are in ms.
205
206
  * @param {Array<LH.Artifacts.NetworkRequest>} requests
206
207
  * @param {number} allowedConcurrentRequests
207
- * @param {number=} endTime
208
+ * @param {number=} endTime In ms
208
209
  * @return {Array<{start: number, end: number}>}
209
210
  */
210
211
  static findNetworkQuietPeriods(requests, allowedConcurrentRequests, endTime = Infinity) {
@@ -215,10 +216,9 @@ class NetworkMonitor extends NetworkMonitorEventEmitter {
215
216
  if (UrlUtils.isNonNetworkProtocol(request.protocol)) return;
216
217
  if (request.protocol === 'ws' || request.protocol === 'wss') return;
217
218
 
218
- // convert the network timestamp to ms
219
- timeBoundaries.push({time: request.networkRequestTime * 1000, isStart: true});
219
+ timeBoundaries.push({time: request.networkRequestTime, isStart: true});
220
220
  if (request.finished) {
221
- timeBoundaries.push({time: request.networkEndTime * 1000, isStart: false});
221
+ timeBoundaries.push({time: request.networkEndTime, isStart: false});
222
222
  }
223
223
  });
224
224
 
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "lighthouse",
3
3
  "type": "module",
4
- "version": "12.0.0-dev.20240523",
4
+ "version": "12.0.0-dev.20240525",
5
5
  "description": "Automated auditing, performance metrics, and best practices for the web.",
6
6
  "main": "./core/index.js",
7
7
  "bin": {