@@ -60,8 +60,10 @@ class AmplifyCLIExecutionReporter {
6060
6161 onRunComplete ( contexts , results ) {
6262 const { publicPath = process . cwd ( ) , filename = 'jest_html_reporters.html' , logoImgPath } = this . _options ;
63+ const runIdx = process . env [ 'RUN_INDEX' ] ?? '0' ;
6364 const logoImg = logoImgPath ? imgToBase64 ( logoImgPath ) : undefined ;
64- fs . ensureDirSync ( publicPath ) ;
65+ const reportPath = path . join ( publicPath , runIdx ) ;
66+ fs . ensureDirSync ( reportPath ) ;
6567
6668 const processedResults = results . testResults . map ( result => {
6769 const resultCopy = { ...result } ;
@@ -73,7 +75,7 @@ class AmplifyCLIExecutionReporter {
7375
7476 const recordingWithPath = recordings . map ( r => {
7577 const castFile = `${ uuid . v4 ( ) } .cast` ;
76- const castFilePath = path . join ( publicPath , castFile ) ;
78+ const castFilePath = path . join ( reportPath , castFile ) ;
7779 fs . writeFileSync ( castFilePath , r . recording ) ;
7880 const rCopy = { ...r } ;
7981 delete rCopy . recording ;
@@ -98,7 +100,7 @@ class AmplifyCLIExecutionReporter {
98100 resultsWithRecordings . _reporterOptions = { ...this . _options , logoImg, customInfos : { } } ;
99101 const data = JSON . stringify ( resultsWithRecordings ) ;
100102
101- const filePath = path . resolve ( publicPath , filename ) ;
103+ const filePath = path . resolve ( reportPath , filename ) ;
102104 // const filePathMock = path.resolve(publicPath, `devMock.json`);
103105 // fs.writeFileSync(filePathMock, data);
104106 const htmlTemplate = fs . readFileSync ( localTemplatePath , 'utf-8' ) ;
0 commit comments