diff --git a/lib/core/queueHandler.js b/lib/core/queueHandler.js index 8af2cfa38..6e087a25c 100644 --- a/lib/core/queueHandler.js +++ b/lib/core/queueHandler.js @@ -92,6 +92,7 @@ export class QueueHandler { constructor(options) { this.options = options; this.errors = []; + this.browsertimePageSummaries = []; } setup(plugins) { @@ -188,7 +189,10 @@ export class QueueHandler { if (this.options.queueStats) { log.info(JSON.stringify(generateStatistics(), undefined, 2)); } - return this.errors; + return { + errors: this.errors, + browsertime: this.browsertimePageSummaries + }; }); } @@ -200,6 +204,10 @@ export class QueueHandler { this.errors.push('' + message.data); } + if (message.type === 'browsertime.pageSummary') { + this.browsertimePageSummaries.push(message.data); + } + // Don't return promise in loop - we don't want to wait for completion, // just post the message. for (let item of this.queues) { diff --git a/lib/sitespeed.js b/lib/sitespeed.js index 84319d592..7a038998d 100644 --- a/lib/sitespeed.js +++ b/lib/sitespeed.js @@ -143,11 +143,11 @@ export async function run(options) { ); // Pass the URLs - const errors = await queueHandler.run(urlSources); + const result = await queueHandler.run(urlSources); // Close the plugins await Promise.all( - runOptionalFunction(allPlugins, 'close', options, errors) + runOptionalFunction(allPlugins, 'close', options, result.errors) ); if (resultUrls.hasBaseUrl()) { @@ -169,7 +169,8 @@ export async function run(options) { } return { - errors, + errors: result.errors, + browsertime: result.browsertime, budgetResult, resultUrl: resultUrls.hasBaseUrl() ? resultUrls.reportSummaryUrl() + '/index.html'