@@ -161,18 +161,23 @@ async function run(lt_config, batches, env) {
161161 . then ( function ( result ) {
162162 const { exit_code, build_info } = result ;
163163 if ( lt_config [ "run_settings" ] [ "retry_failed" ] == true && build_info != null ) {
164- let failed_tests = [ ] ;
164+ let failed_test_suites = [ ] ;
165165 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 ) ;
168176 }
169177 }
170- if ( failed_tests . length > 0 ) {
178+ if ( failed_test_suites . length > 0 ) {
171179 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 ]
176181 retry_run ( lt_config , batches , env )
177182 . then ( function ( exit_code ) {
178183 if ( exit_code ) {
@@ -183,12 +188,7 @@ async function run(lt_config, batches, env) {
183188 . catch ( function ( error ) {
184189 console . log ( error ) ;
185190 resolve ( 1 ) ;
186- } ) ;
187- } )
188- . catch ( function ( err ) {
189- console . log ( err ) ;
190- resolve ( 1 ) ;
191- } ) ;
191+ } ) ;
192192 } else {
193193 resolve ( exit_code ) ;
194194 }
@@ -318,6 +318,11 @@ async function retry_run(lt_config, batches, env) {
318318 } ) ;
319319}
320320
321+ function findSpecFile ( testSuite , buildInfoData ) {
322+ const foundTest = testSuite . find ( ( test ) => test . path === buildInfoData . path ) ;
323+ return foundTest ? foundTest . spec_file : null ;
324+ }
325+
321326module . exports = {
322327 run_batches : run ,
323328 run_batches_retry : retry_run ,
0 commit comments