Repository: codecov/uploader
Pull request #861 (2022-08-23 21:15:29)

feat: accept comma-separated files in args

codecov[bot]: # [Codecov](https://app.codecov.io/gh/codecov/uploader/compare/861?src=pr&el=h1&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=codecov) Report
> Merging [#861](https://app.codecov.io/gh/codecov/uploader/compare/861?src=pr&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=codecov) (bf28612) into [main](https://codecov.io/gh/codecov/uploader/commit/fa19f0aba8dcc41630140501a301bca3440b1fd7?el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=codecov) (fa19f0a) will **not change** coverage.
> The diff coverage is `100.00%`.

```diff
@@           Coverage Diff           @@
##             main     #861   +/-   ##
=======================================
  Coverage   91.87%   91.87%           
=======================================
  Files          34       34           
  Lines        1181     1181           
  Branches      244      244           
=======================================
  Hits         1085     1085           
  Misses         64       64           
  Partials       32       32           
```

| Flag | Coverage Δ | |
|---|---|---|
| alpine | `91.87% <100.00%> (ø)` | |
| alpine-proxy | `91.87% <100.00%> (ø)` | |
| alpine-without-git | `91.87% <100.00%> (ø)` | |
| linux | `91.87% <100.00%> (ø)` | |
| linux-without-git | `91.87% <100.00%> (ø)` | |
| macos | `91.87% <100.00%> (ø)` | |
| macos-without-git | `91.87% <100.00%> (ø)` | |
| windows | `91.87% <100.00%> (ø)` | |
| windows-without-git | `91.87% <100.00%> (ø)` | |

Flags with carried forward coverage won't be shown. [Click here](https://docs.codecov.io/docs/carryforward-flags?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=codecov#carryforward-flags-in-the-pull-request-comment) to find out more.

| [Impacted Files](https://app.codecov.io/gh/codecov/uploader/compare/861?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=codecov) | Coverage Δ | |
|---|---|---|
| [src/index.ts](https://app.codecov.io/gh/codecov/uploader/compare/861/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=codecov#diff-c3JjL2luZGV4LnRz) | `74.35% <100.00%> (ø)` | |


Patch:
diff --git a/src/index.ts b/src/index.ts
index b9ac184..333bb51 100644
--- a/src/index.ts
+++ b/src/index.ts
@@ -195,7 +195,7 @@ export async function main(
   let coverageFilePaths: string[] = []
   if (args.file !== undefined) {
     if (typeof args.file === 'string') {
-      requestedPaths = [args.file]
+      requestedPaths = args.file.split(',')
     } else {
       requestedPaths = args.file // Already an array
     }


Test patch:
diff --git a/test/index.test.ts b/test/index.test.ts
index 714f3a4..04979a0 100644
--- a/test/index.test.ts
+++ b/test/index.test.ts
@@ -318,6 +318,31 @@ describe('Uploader Core', () => {
     )
   })
 
+  it('Can find multiple specified files as comma-separated', async () => {
+    const log = jest.spyOn(console, 'log').mockImplementation(() => {
+      // intentionally empty
+    })
+    await app.main({
+      dryRun: 'true',
+      file: 'test/fixtures/coverage.txt,test/fixtures/other/coverage.txt,test/does/not/exist.txt',
+      name: 'customname',
+      token: 'abcdefg',
+      url: 'https://codecov.io',
+      flags: '',
+      slug: '',
+      upstream: ''
+    })
+    expect(log).toHaveBeenCalledWith(
+      expect.stringMatching(/Processing.*test\/fixtures\/coverage\.txt\.\.\./),
+    )
+    expect(log).toHaveBeenCalledWith(
+      expect.stringMatching(/Processing.*test\/fixtures\/other\/coverage\.txt\.\.\./),
+    )
+    expect(log).not.toHaveBeenCalledWith(
+      expect.stringMatching(/Processing.*test\/does\/not\/exist\.txt\.\.\./),
+    )
+  })
+
   it('will process blocked files, if passed via -f', async () => {
     const log = jest.spyOn(console, 'log').mockImplementation(() => {
       // intentionally empty