Run without cli (#2746)

* Make sure we fail on errors
* Fix failing code
This commit is contained in:
Peter Hedenskog 2019-11-03 19:04:11 +01:00 committed by GitHub
parent 32e4bc2820
commit 855571c6ba
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 20 additions and 17 deletions

View File

@ -125,7 +125,8 @@ function findTimings(timings, start, end) {
module.exports = {
async getFilmstrip(browsertimeData, run, dir, options, fullPath) {
let doWeHaveFilmstrip =
options.browsertime.chrome.enableTraceScreenshots === true ||
(options.browsertime.chrome &&
options.browsertime.chrome.enableTraceScreenshots === true) ||
(options.browsertime.visualMetrics === true &&
options.browsertime.videoParams.createFilmstrip === true);

View File

@ -131,7 +131,7 @@ block content
section#video-panel
include ../video/index.pug
if (options.browsertime.video || options.browsertime.visualMetrics) && options.videoParams.createFilmstrip || options.browsertime.chrome.enableTraceScreenshots
if (options.browsertime.video || options.browsertime.visualMetrics) && options.videoParams.createFilmstrip || options.browsertime.chrome && options.browsertime.chrome.enableTraceScreenshots
section#filmstrip-panel
include ../filmstrip/index.pug

View File

@ -10,7 +10,7 @@
if options.browsertime.video
a(id='video', href='#video', onclick='return selectTab(this, true);')
| Video
if (options.browsertime.visualMetrics && options.videoParams.createFilmstrip) || options.browsertime.chrome.enableTraceScreenshots
if (options.browsertime.visualMetrics && options.videoParams.createFilmstrip) || options.browsertime.chrome && options.browsertime.chrome.enableTraceScreenshots
a(id='filmstrip', href='#filmstrip', onclick='return selectTab(this, true);')
| Filmstrip
if d.coach && d.coach.run

View File

@ -136,7 +136,7 @@ block content
section#video-panel
include ../video/index.pug
if (options.browsertime.video || options.browsertime.visualMetrics) && options.videoParams.createFilmstrip || options.browsertime.chrome.enableTraceScreenshots
if (options.browsertime.video || options.browsertime.visualMetrics) && options.videoParams.createFilmstrip || options.browsertime.chrome && options.browsertime.chrome.enableTraceScreenshots
section#filmstrip-panel
include ../filmstrip/index.pug

View File

@ -10,7 +10,7 @@
if options.browsertime.video
a(id='video', href='#video', onclick='return selectTab(this, true);')
| Video
if (options.browsertime.visualMetrics && options.videoParams.createFilmstrip) || options.browsertime.chrome.enableTraceScreenshots
if (options.browsertime.visualMetrics && options.videoParams.createFilmstrip) || options.browsertime.chrome && options.browsertime.chrome.enableTraceScreenshots
a(id='filmstrip', href='#filmstrip', onclick='return selectTab(this, true);')
| Filmstrip
if d.coach && d.coach.pageSummary

View File

@ -1,9 +1,9 @@
const sitespeed = require('../lib/sitespeed');
const urls = ['https://www.sitespeed.io/'];
function run() {
sitespeed
.run({
async function run() {
try {
let result = await sitespeed.run({
urls,
browsertime: {
iterations: 1,
@ -12,18 +12,20 @@ function run() {
profile: 'native'
}
}
})
.then(results => {
if (results.error) {
throw new Error(results.error);
}
})
.catch(err => {
});
if (result.errors.length > 0) {
/* eslint-disable no-console */
console.error(err);
console.error(result.errors);
/* eslint-enable no-console */
process.exit(1);
});
}
} catch (e) {
/* eslint-disable no-console */
console.error(e);
/* eslint-enable no-console */
process.exit(1);
}
}
run();