@@ -92,7 +92,6 @@ class TestRunner {
92
92
}
93
93
} ) ;
94
94
95
- const config = this . _config ;
96
95
const aggregatedResults = createAggregatedResults ( tests . length ) ;
97
96
const estimatedTime = Math . ceil (
98
97
getEstimatedTime ( timings , this . _options . maxWorkers ) / 1000 ,
@@ -120,7 +119,7 @@ class TestRunner {
120
119
return ;
121
120
}
122
121
addResult ( aggregatedResults , testResult ) ;
123
- this . _dispatcher . onTestResult ( config , testResult , aggregatedResults ) ;
122
+ this . _dispatcher . onTestResult ( test . config , testResult , aggregatedResults ) ;
124
123
this . _bailIfNeeded ( aggregatedResults , watcher ) ;
125
124
} ;
126
125
@@ -135,10 +134,11 @@ class TestRunner {
135
134
test . path ,
136
135
) ;
137
136
addResult ( aggregatedResults , testResult ) ;
138
- this . _dispatcher . onTestResult ( config , testResult , aggregatedResults ) ;
137
+ this . _dispatcher . onTestResult ( test . config , testResult , aggregatedResults ) ;
139
138
} ;
140
139
141
140
const updateSnapshotState = ( ) => {
141
+ const config = this . _config ;
142
142
const status = snapshot . cleanup (
143
143
this . _context . hasteFS ,
144
144
config . updateSnapshot ,
@@ -151,7 +151,7 @@ class TestRunner {
151
151
aggregatedResults . snapshot . filesRemoved ) ) ;
152
152
} ;
153
153
154
- this . _dispatcher . onRunStart ( config , aggregatedResults , {
154
+ this . _dispatcher . onRunStart ( this . _config , aggregatedResults , {
155
155
estimatedTime,
156
156
showStatus : ! runInBand ,
157
157
} ) ;
@@ -169,7 +169,7 @@ class TestRunner {
169
169
updateSnapshotState ( ) ;
170
170
aggregatedResults . wasInterrupted = watcher . isInterrupted ( ) ;
171
171
172
- this . _dispatcher . onRunComplete ( config , aggregatedResults ) ;
172
+ this . _dispatcher . onRunComplete ( this . _config , aggregatedResults ) ;
173
173
174
174
const anyTestFailures = ! ( aggregatedResults . numFailedTests === 0 &&
175
175
aggregatedResults . numRuntimeErrorTestSuites === 0 ) ;
@@ -190,17 +190,19 @@ class TestRunner {
190
190
) {
191
191
const mutex = throat ( 1 ) ;
192
192
return tests . reduce (
193
- ( promise , test ) => mutex ( ( ) => promise
194
- . then ( ( ) => {
195
- if ( watcher . isInterrupted ( ) ) {
196
- throw new CancelRun ( ) ;
197
- }
198
-
199
- this . _dispatcher . onTestStart ( test . config , test . path ) ;
200
- return runTest ( test . path , test . config , this . _context . resolver ) ;
201
- } )
202
- . then ( result => onResult ( test , result ) )
203
- . catch ( err => onFailure ( test , err ) ) ) ,
193
+ ( promise , test ) =>
194
+ mutex ( ( ) =>
195
+ promise
196
+ . then ( ( ) => {
197
+ if ( watcher . isInterrupted ( ) ) {
198
+ throw new CancelRun ( ) ;
199
+ }
200
+
201
+ this . _dispatcher . onTestStart ( test . config , test . path ) ;
202
+ return runTest ( test . path , test . config , this . _context . resolver ) ;
203
+ } )
204
+ . then ( result => onResult ( test , result ) )
205
+ . catch ( err => onFailure ( test , err ) ) ) ,
204
206
Promise . resolve ( ) ,
205
207
) ;
206
208
}
@@ -225,19 +227,20 @@ class TestRunner {
225
227
226
228
// Send test suites to workers continuously instead of all at once to track
227
229
// the start time of individual tests.
228
- const runTestInWorker = ( { config, path} ) => mutex ( ( ) => {
229
- if ( watcher . isInterrupted ( ) ) {
230
- return Promise . reject ( ) ;
231
- }
232
- this . _dispatcher . onTestStart ( config , path ) ;
233
- return worker ( {
234
- config,
235
- path,
236
- rawModuleMap : watcher . isWatchMode ( )
237
- ? this . _context . moduleMap . getRawModuleMap ( )
238
- : null ,
230
+ const runTestInWorker = ( { config, path} ) =>
231
+ mutex ( ( ) => {
232
+ if ( watcher . isInterrupted ( ) ) {
233
+ return Promise . reject ( ) ;
234
+ }
235
+ this . _dispatcher . onTestStart ( config , path ) ;
236
+ return worker ( {
237
+ config,
238
+ path,
239
+ rawModuleMap : watcher . isWatchMode ( )
240
+ ? this . _context . moduleMap . getRawModuleMap ( )
241
+ : null ,
242
+ } ) ;
239
243
} ) ;
240
- } ) ;
241
244
242
245
const onError = ( err , test ) => {
243
246
onFailure ( test , err ) ;
0 commit comments