From 7b86c71e10dcfbd851c5c42c5719a8693b9de0b7 Mon Sep 17 00:00:00 2001 From: Paul Irish Date: Mon, 15 May 2017 13:25:14 -0700 Subject: [PATCH] Enhance error wording around busy traces. (#2247) --- lighthouse-core/audits/consistently-interactive.js | 6 ++++-- lighthouse-core/gather/computed/first-interactive.js | 3 ++- .../test/audits/consistently-interactive-test.js | 10 +++++----- .../test/gather/computed/first-interactive-test.js | 2 +- 4 files changed, 12 insertions(+), 9 deletions(-) diff --git a/lighthouse-core/audits/consistently-interactive.js b/lighthouse-core/audits/consistently-interactive.js index 950d725d4514..521205505579 100644 --- a/lighthouse-core/audits/consistently-interactive.js +++ b/lighthouse-core/audits/consistently-interactive.js @@ -193,8 +193,10 @@ class ConsistentlyInteractiveMetric extends Audit { } } - const culprit = cpuCandidate ? 'Network' : 'CPU'; - throw new Error(`${culprit} did not quiet for at least 5s before the end of the trace.`); + const culprit = cpuCandidate ? 'Network' : 'Main thread'; + throw new Error(`${culprit} activity continued through the end of the trace recording. ` + + 'Consistently Interactive requires a minimum of 5 seconds of both main thread idle and ' + + 'network idle.'); } /** diff --git a/lighthouse-core/gather/computed/first-interactive.js b/lighthouse-core/gather/computed/first-interactive.js index 03794f334578..a8cefc9ff74a 100644 --- a/lighthouse-core/gather/computed/first-interactive.js +++ b/lighthouse-core/gather/computed/first-interactive.js @@ -26,7 +26,8 @@ const MIN_TASK_CLUSTER_PADDING = 1000; const MIN_TASK_CLUSTER_FMP_DISTANCE = 5000; const MAX_QUIET_WINDOW_SIZE = 5000; -const TRACE_BUSY_MSG = 'trace was busy the entire time'; +const TRACE_BUSY_MSG = 'The main thread was busy for the entire trace recording. ' + + 'First Interactive requires the main thread to be idle for several seconds.'; // Window size should be three seconds at 15 seconds after FMP const EXPONENTIATION_COEFFICIENT = -Math.log(3 - 1) / 15; diff --git a/lighthouse-core/test/audits/consistently-interactive-test.js b/lighthouse-core/test/audits/consistently-interactive-test.js index 62723fde2fcb..c782205af924 100644 --- a/lighthouse-core/test/audits/consistently-interactive-test.js +++ b/lighthouse-core/test/audits/consistently-interactive-test.js @@ -77,7 +77,7 @@ describe('Performance: consistently-interactive audit', () => { assert.throws(() => { ConsistentlyInteractive.findOverlappingQuietPeriods(cpu, network, traceOfTab); - }, /did not quiet/); + }, /activity continued/); }); it('should throw when CPU is quiet but network is not', () => { @@ -96,7 +96,7 @@ describe('Performance: consistently-interactive audit', () => { assert.throws(() => { ConsistentlyInteractive.findOverlappingQuietPeriods(cpu, network, traceOfTab); - }, /Network did not quiet/); + }, /Network activity continued/); }); it('should throw when network is quiet but CPU is not', () => { @@ -114,7 +114,7 @@ describe('Performance: consistently-interactive audit', () => { assert.throws(() => { ConsistentlyInteractive.findOverlappingQuietPeriods(cpu, network, traceOfTab); - }, /CPU did not quiet/); + }, /Main thread activity continued/); }); it('should handle unfinished network requests', () => { @@ -132,7 +132,7 @@ describe('Performance: consistently-interactive audit', () => { assert.throws(() => { ConsistentlyInteractive.findOverlappingQuietPeriods(cpu, network, traceOfTab); - }, /Network did not quiet/); + }, /Network activity continued/); }); it('should find first overlapping quiet period', () => { @@ -162,7 +162,7 @@ describe('Performance: consistently-interactive audit', () => { {start: 11500, end: 19000}, {start: 11500, end: 19000}, {start: 11500, end: 19500}, - // quiet period during CPU activity + // quiet period during Main thread activity {start: 28000, end: 32000}, {start: 28000, end: 32000}, {start: 28000, end: 35000}, diff --git a/lighthouse-core/test/gather/computed/first-interactive-test.js b/lighthouse-core/test/gather/computed/first-interactive-test.js index 8ace2f5e92cf..37a822543c0f 100644 --- a/lighthouse-core/test/gather/computed/first-interactive-test.js +++ b/lighthouse-core/test/gather/computed/first-interactive-test.js @@ -284,7 +284,7 @@ describe('FirstInteractive computed artifact:', () => { const longTasks = [{start: 4000, end: 5700}]; assert.throws(() => { FirstInteractive.findQuietWindow(200, 6000, longTasks); - }, /trace was busy/); + }, /main thread was busy/); }); }); });