@@ -161,18 +161,23 @@ async function run(lt_config, batches, env) {
161
161
. then ( function ( result ) {
162
162
const { exit_code, build_info } = result ;
163
163
if ( lt_config [ "run_settings" ] [ "retry_failed" ] == true && build_info != null ) {
164
- let failed_tests = [ ] ;
164
+ let failed_test_suites = [ ] ;
165
165
for ( i = 0 ; i < build_info [ "data" ] . length ; i ++ ) {
166
- if ( build_info [ "data" ] [ i ] [ "status_ind" ] == "failed" ) {
167
- failed_tests . push ( build_info [ "data" ] [ i ] [ "path" ] ) ;
166
+ if ( build_info [ "data" ] [ i ] [ "status_ind" ] == "failed" ) {
167
+ let failed_spec = findSpecFile ( lt_config [ "test_suite" ] , build_info [ "data" ] [ i ] )
168
+ let failed_suite = {
169
+ spec_file : failed_spec ,
170
+ path : build_info [ "data" ] [ i ] [ "path" ] ,
171
+ browser : build_info [ "data" ] [ i ] [ "browser" ] ,
172
+ version : build_info [ "data" ] [ i ] [ "version" ] ,
173
+ platform : build_info [ "data" ] [ i ] [ "platform" ]
174
+ }
175
+ failed_test_suites . push ( failed_suite ) ;
168
176
}
169
177
}
170
- if ( failed_tests . length > 0 ) {
178
+ if ( failed_test_suites . length > 0 ) {
171
179
console . log ( "Retrying failed tests." )
172
- lt_config [ "run_settings" ] [ "specs" ] = failed_tests ;
173
- batcher
174
- . make_batches ( lt_config )
175
- . then ( function ( batches ) {
180
+ let batches = [ failed_test_suites ]
176
181
retry_run ( lt_config , batches , env )
177
182
. then ( function ( exit_code ) {
178
183
if ( exit_code ) {
@@ -183,12 +188,7 @@ async function run(lt_config, batches, env) {
183
188
. catch ( function ( error ) {
184
189
console . log ( error ) ;
185
190
resolve ( 1 ) ;
186
- } ) ;
187
- } )
188
- . catch ( function ( err ) {
189
- console . log ( err ) ;
190
- resolve ( 1 ) ;
191
- } ) ;
191
+ } ) ;
192
192
} else {
193
193
resolve ( exit_code ) ;
194
194
}
@@ -318,6 +318,11 @@ async function retry_run(lt_config, batches, env) {
318
318
} ) ;
319
319
}
320
320
321
+ function findSpecFile ( testSuite , buildInfoData ) {
322
+ const foundTest = testSuite . find ( ( test ) => test . path === buildInfoData . path ) ;
323
+ return foundTest ? foundTest . spec_file : null ;
324
+ }
325
+
321
326
module . exports = {
322
327
run_batches : run ,
323
328
run_batches_retry : retry_run ,
0 commit comments