Skip to content

Commit

Permalink
Print internal errors when precompiler setup or globbing fails
Browse files Browse the repository at this point in the history
  • Loading branch information
yovasx2 authored and novemberborn committed Aug 11, 2019
1 parent 8628976 commit b27cb8d
Showing 1 changed file with 15 additions and 2 deletions.
17 changes: 15 additions & 2 deletions lib/api.js
Expand Up @@ -51,6 +51,7 @@ class Api extends Emittery {
}

async run(files = [], runtimeOptions = {}) {
let setupOrGlobError;
files = files.map(file => path.resolve(this.options.resolveTestsFrom, file));

const apiOptions = this.options;
Expand Down Expand Up @@ -106,9 +107,12 @@ class Api extends Emittery {
}
};

let precompiler;
let helpers;

try {
const precompiler = await this._setupPrecompiler();
let helpers = [];
precompiler = await this._setupPrecompiler(); // eslint-disable-line require-atomic-updates
helpers = [];
if (files.length === 0 || precompiler.enabled) {
let found;
if (precompiler.enabled) {
Expand All @@ -122,7 +126,12 @@ class Api extends Emittery {
({tests: files} = found);
}
}
} catch (error) {
files = [];
setupOrGlobError = error;
}

try {
if (this.options.parallelRuns) {
const {currentIndex, totalRuns} = this.options.parallelRuns;
const fileCount = files.length;
Expand Down Expand Up @@ -150,6 +159,10 @@ class Api extends Emittery {
status: runStatus
});

if (setupOrGlobError) {
throw setupOrGlobError;
}

// Bail out early if no files were found.
if (files.length === 0) {
return runStatus;
Expand Down

0 comments on commit b27cb8d

Please sign in to comment.