@@ -60,8 +60,10 @@ class AmplifyCLIExecutionReporter {
60
60
61
61
onRunComplete ( contexts , results ) {
62
62
const { publicPath = process . cwd ( ) , filename = 'jest_html_reporters.html' , logoImgPath } = this . _options ;
63
+ const runIdx = process . env [ 'RUN_INDEX' ] ?? '0' ;
63
64
const logoImg = logoImgPath ? imgToBase64 ( logoImgPath ) : undefined ;
64
- fs . ensureDirSync ( publicPath ) ;
65
+ const reportPath = path . join ( publicPath , runIdx ) ;
66
+ fs . ensureDirSync ( reportPath ) ;
65
67
66
68
const processedResults = results . testResults . map ( result => {
67
69
const resultCopy = { ...result } ;
@@ -73,7 +75,7 @@ class AmplifyCLIExecutionReporter {
73
75
74
76
const recordingWithPath = recordings . map ( r => {
75
77
const castFile = `${ uuid . v4 ( ) } .cast` ;
76
- const castFilePath = path . join ( publicPath , castFile ) ;
78
+ const castFilePath = path . join ( reportPath , castFile ) ;
77
79
fs . writeFileSync ( castFilePath , r . recording ) ;
78
80
const rCopy = { ...r } ;
79
81
delete rCopy . recording ;
@@ -98,7 +100,7 @@ class AmplifyCLIExecutionReporter {
98
100
resultsWithRecordings . _reporterOptions = { ...this . _options , logoImg, customInfos : { } } ;
99
101
const data = JSON . stringify ( resultsWithRecordings ) ;
100
102
101
- const filePath = path . resolve ( publicPath , filename ) ;
103
+ const filePath = path . resolve ( reportPath , filename ) ;
102
104
// const filePathMock = path.resolve(publicPath, `devMock.json`);
103
105
// fs.writeFileSync(filePathMock, data);
104
106
const htmlTemplate = fs . readFileSync ( localTemplatePath , 'utf-8' ) ;
0 commit comments