From 5e858804d42282bdb3e04877edaa426365f931d0 Mon Sep 17 00:00:00 2001 From: matthiasgekiere Date: Fri, 4 Sep 2026 19:36:01 +0200 Subject: [PATCH 1/2] Add logging for discovered coverage files and include for which target branch Signed-off-by: matthiasgekiere --- __tests__/main.test.js | 45 ++++++++++++++++++++++++++++++++++++++++++ src/main.js | 8 ++++++-- 2 files changed, 51 insertions(+), 2 deletions(-) diff --git a/__tests__/main.test.js b/__tests__/main.test.js index f882f64..d9cf4cc 100644 --- a/__tests__/main.test.js +++ b/__tests__/main.test.js @@ -213,6 +213,45 @@ describe('main.js security - single file path validation', () => { }); }); + describe('coverage file discovery logging', () => { + it('logs found coverage file paths for a single file', async () => { + const previousCwd = process.cwd(); + process.chdir(tmpDir); + + try { + await fs.writeFile('lcov.info', 'TN:\nSF:src/test.js\nDA:1,5\nend_of_record\n'); + mockGetInput.mockReturnValue('lcov.info'); + + await run(); + + expect(mockInfo).toHaveBeenCalledWith( + 'Found 1 coverage file(s) at path(s) \n\tlcov.info', + ); + } finally { + process.chdir(previousCwd); + } + }); + + it('logs found coverage file paths for multiple files', async () => { + const previousCwd = process.cwd(); + process.chdir(tmpDir); + + try { + await fs.writeFile('lcov1.info', 'TN:\nSF:src/a.js\nDA:1,5\nend_of_record\n'); + await fs.writeFile('lcov2.info', 'TN:\nSF:src/b.js\nDA:1,3\nend_of_record\n'); + mockGetInput.mockReturnValue('lcov1.info lcov2.info'); + + await run(); + + expect(mockInfo).toHaveBeenCalledWith( + 'Found 2 coverage file(s) at path(s) \n\tlcov1.info\n\tlcov2.info', + ); + } finally { + process.chdir(previousCwd); + } + }); + }); + describe('valid single file path', () => { it('accepts and processes valid relative single file path', async () => { const previousCwd = process.cwd(); @@ -242,6 +281,12 @@ describe('main.js security - single file path validation', () => { expect(headers['Content-Type']).toBe('application/json'); expect(headers['Content-Encoding']).toBeUndefined(); + expect(mockInfo).not.toHaveBeenCalledWith( + `Uploading coverage report for branch haahah to Aikido...`, + ); + expect(mockInfo).toHaveBeenCalledWith( + `Uploading coverage report for branch main to Aikido...`, + ); expect(mockInfo).toHaveBeenCalledWith('Upload succeeded.'); } finally { process.chdir(previousCwd); diff --git a/src/main.js b/src/main.js index 0ffbac6..e44058b 100644 --- a/src/main.js +++ b/src/main.js @@ -28,7 +28,9 @@ async function run() { throw new Error(`No lcov file(s) provided. Specify at least one path.`); } - core.info(`Found ${inputs.lcovFilePaths.length} coverage file(s):`); + core.info( + `Found ${inputs.lcovFilePaths.length} coverage file(s) at path(s) \n\t${inputs.lcovFilePaths.join('\n\t')}`, + ); let codeCoverageFileContent = null; @@ -50,7 +52,9 @@ async function run() { throw new Error('Something went wrong while validating the coverage file(s)'); } - core.info('Uploading coverage report to Aikido...'); + core.info( + `Uploading coverage report for branch ${process.env.GITHUB_HEAD_REF || process.env.GITHUB_REF_NAME} to Aikido...`, + ); await uploadCoverage(codeCoverageFileContent); core.info(`Upload succeeded.`); From d59f6d9b540e17fbb39efa19d28931f41de04fe1 Mon Sep 17 00:00:00 2001 From: matthiasgekiere Date: Fri, 4 Sep 2026 19:39:10 +0200 Subject: [PATCH 2/2] fix formatting Signed-off-by: matthiasgekiere --- __tests__/main.test.js | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/__tests__/main.test.js b/__tests__/main.test.js index d9cf4cc..7f981fe 100644 --- a/__tests__/main.test.js +++ b/__tests__/main.test.js @@ -224,9 +224,7 @@ describe('main.js security - single file path validation', () => { await run(); - expect(mockInfo).toHaveBeenCalledWith( - 'Found 1 coverage file(s) at path(s) \n\tlcov.info', - ); + expect(mockInfo).toHaveBeenCalledWith('Found 1 coverage file(s) at path(s) \n\tlcov.info'); } finally { process.chdir(previousCwd); }