Run without cli (#2746)
* Make sure we fail on errors * Fix failing code
This commit is contained in:
parent
32e4bc2820
commit
855571c6ba
|
|
@ -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);
|
||||
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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();
|
||||
|
|
|
|||
Loading…
Reference in New Issue