File tree Expand file tree Collapse file tree 1 file changed +15
-2
lines changed Expand file tree Collapse file tree 1 file changed +15
-2
lines changed Original file line number Diff line number Diff line change @@ -51,6 +51,7 @@ class Api extends Emittery {
5151 }
5252
5353 async run ( files = [ ] , runtimeOptions = { } ) {
54+ let setupOrGlobError ;
5455 files = files . map ( file => path . resolve ( this . options . resolveTestsFrom , file ) ) ;
5556
5657 const apiOptions = this . options ;
@@ -106,9 +107,12 @@ class Api extends Emittery {
106107 }
107108 } ;
108109
110+ let precompiler ;
111+ let helpers ;
112+
109113 try {
110- const precompiler = await this . _setupPrecompiler ( ) ;
111- let helpers = [ ] ;
114+ precompiler = await this . _setupPrecompiler ( ) ; // eslint-disable-line require-atomic-updates
115+ helpers = [ ] ;
112116 if ( files . length === 0 || precompiler . enabled ) {
113117 let found ;
114118 if ( precompiler . enabled ) {
@@ -122,7 +126,12 @@ class Api extends Emittery {
122126 ( { tests : files } = found ) ;
123127 }
124128 }
129+ } catch ( error ) {
130+ files = [ ] ;
131+ setupOrGlobError = error ;
132+ }
125133
134+ try {
126135 if ( this . options . parallelRuns ) {
127136 const { currentIndex, totalRuns} = this . options . parallelRuns ;
128137 const fileCount = files . length ;
@@ -150,6 +159,10 @@ class Api extends Emittery {
150159 status : runStatus
151160 } ) ;
152161
162+ if ( setupOrGlobError ) {
163+ throw setupOrGlobError ;
164+ }
165+
153166 // Bail out early if no files were found.
154167 if ( files . length === 0 ) {
155168 return runStatus ;
You can’t perform that action at this time.
0 commit comments