@@ -96,13 +96,8 @@ const createWorkerObjects = (testGroups, config, testRoot, options, selectedRuns
9696 const workersToExecute = [ ] ;
9797
9898 const currentOutputFolder = config . output ;
99- let currentMochawesomeReportDir ;
100- let currentMochaJunitReporterFile ;
101-
102- if ( config . mocha . reporterOptions ) {
103- currentMochawesomeReportDir = config . mocha . reporterOptions ?. mochawesome . options . reportDir ;
104- currentMochaJunitReporterFile = config . mocha . reporterOptions [ 'mocha-junit-reporter' ] . options . mochaFile ;
105- }
99+ const currentMochawesomeReportDir = config . mocha . reporterOptions ?. mochawesome . options . reportDir ;
100+ const currentMochaJunitReporterFile = config . mocha . reporterOptions [ 'mocha-junit-reporter' ] . options . mochaFile ;
106101
107102 collection . createRuns ( selectedRuns , config ) . forEach ( ( worker ) => {
108103 const separator = path . sep ;
@@ -112,8 +107,8 @@ const createWorkerObjects = (testGroups, config, testRoot, options, selectedRuns
112107 if ( config . mocha && config . mocha . reporterOptions ) {
113108 _config . mocha . reporterOptions . mochawesome . options . reportDir = `${ currentMochawesomeReportDir } ${ separator } ${ workerName } ` ;
114109
115- let _tempArray = currentMochaJunitReporterFile . split ( separator ) ;
116- _tempArray = _tempArray . splice ( _tempArray . length - 2 , 0 , workerName ) ;
110+ const _tempArray = currentMochaJunitReporterFile . split ( separator ) ;
111+ _tempArray . splice ( _tempArray . findIndex ( item => item . includes ( '.xml' ) ) , 0 , workerName ) ;
117112 _config . mocha . reporterOptions [ 'mocha-junit-reporter' ] . options . mochaFile = _tempArray . join ( separator ) ;
118113 }
119114 workerName = worker . getOriginalName ( ) || worker . getName ( ) ;
0 commit comments