@@ -27,13 +27,14 @@ describe("Artifact Processing Tests", () => {
2727
2828 beforeAll ( ( ) => {
2929 const runnerTemp = path . join ( __dirname , ".." ) ;
30- const runId = "" ;
30+ const runId = "123" ;
31+ const actionName = "run-tests" ;
3132 const osInfo = getOSInfo ( ) ;
3233 const workspace = path . join ( osInfo . workspaceParent , "workspace" ) ;
3334
34- copyTestDataFile ( osInfo . osName , runnerTemp ) ;
35+ copyTestDataFile ( osInfo . osName , runnerTemp , runId , actionName ) ;
3536
36- testResultsData = testResultsSummary . getTestResults ( runnerTemp , runId , workspace ) ;
37+ testResultsData = testResultsSummary . getTestResults ( runnerTemp , runId , actionName , workspace ) ;
3738 testResults = testResultsData . TestResults ;
3839 stats = testResultsData . Stats ;
3940 } ) ;
@@ -48,7 +49,7 @@ describe("Artifact Processing Tests", () => {
4849 throw new Error ( `Unsupported OS: ${ os } ` ) ;
4950 }
5051
51- function copyTestDataFile ( osName : string , runnerTemp : string ) {
52+ function copyTestDataFile ( osName : string , runnerTemp : string , runId : string , actionName : string ) {
5253 const sourceFilePath = path . join (
5354 __dirname ,
5455 "test-data" ,
@@ -57,7 +58,7 @@ describe("Artifact Processing Tests", () => {
5758 osName ,
5859 "matlabTestResults.json" ,
5960 ) ;
60- const destinationFilePath = path . join ( runnerTemp ! , "matlabTestResults .json" ) ;
61+ const destinationFilePath = path . join ( runnerTemp , "matlabTestResults_" + runId + "_" + actionName + " .json") ;
6162
6263 try {
6364 fs . copyFileSync ( sourceFilePath , destinationFilePath ) ;
@@ -358,14 +359,15 @@ describe("Error Handling Tests", () => {
358359
359360 // Set up environment variables
360361 process . env . RUNNER_TEMP = path . join ( __dirname , ".." ) ;
361- process . env . GITHUB_RUN_ID = "" ;
362+ process . env . GITHUB_RUN_ID = "123" ;
363+ process . env . GITHUB_ACTION = "run-tests" ;
362364
363365 // Create a file with invalid JSON
364- const invalidJsonPath = path . join ( process . env . RUNNER_TEMP , "matlabTestResults .json" ) ;
366+ const invalidJsonPath = path . join ( process . env . RUNNER_TEMP , "matlabTestResults_123_run-tests .json" ) ;
365367 fs . writeFileSync ( invalidJsonPath , "{ invalid json content" ) ;
366368
367369 try {
368- const result = testResultsSummary . getTestResults ( process . env . RUNNER_TEMP ! , process . env . GITHUB_RUN_ID ! , "" ) ;
370+ const result = testResultsSummary . getTestResults ( process . env . RUNNER_TEMP , process . env . GITHUB_RUN_ID , process . env . GITHUB_ACTION , "" ) ;
369371
370372 // Should return empty results
371373 expect ( result . TestResults ) . toEqual ( [ ] ) ;
@@ -407,14 +409,15 @@ describe("Error Handling Tests", () => {
407409
408410 // Set up environment variables
409411 process . env . RUNNER_TEMP = path . join ( __dirname , ".." ) ;
410- process . env . GITHUB_RUN_ID = "" ;
412+ process . env . GITHUB_RUN_ID = "123" ;
413+ process . env . GITHUB_ACTION = "run-tests" ;
411414
412415 // Create a valid JSON file
413- const validJsonPath = path . join ( process . env . RUNNER_TEMP , "matlabTestResults .json" ) ;
416+ const validJsonPath = path . join ( process . env . RUNNER_TEMP , "matlabTestResults_123_run-tests .json" ) ;
414417 fs . writeFileSync ( validJsonPath , "[]" ) ; // Empty array - valid JSON
415418
416419 try {
417- const result = testResultsSummary . getTestResults ( process . env . RUNNER_TEMP ! , process . env . GITHUB_RUN_ID ! , "" ) ;
420+ const result = testResultsSummary . getTestResults ( process . env . RUNNER_TEMP , process . env . GITHUB_RUN_ID , process . env . GITHUB_ACTION , "" ) ;
418421
419422 // Should still return results even if deletion fails
420423 expect ( result ) . toBeDefined ( ) ;
0 commit comments