Skip to content

Not able to find coverage file #487

Open
@rossPatton

Description

I am trying to set up coverage integration with github actions

I am using the recommended github action, paambaati/[email protected]

I get an error that doesn't really help, ie, it's unclear what I need to do in order to fix

Here's my github workflow:

on: 'push'

jobs:
  coverage:
    env:
      ...(redacted)

    runs-on: ubuntu-latest
    steps:
    - uses: actions/checkout@v1

    - name: Setup Node
      uses: actions/setup-node@v1
      with:
        node-version: '16.2'

    - name: Cache dependencies
      uses: actions/cache@v1
      with:
        path: ./node\_modules
        key: ${{ runner.OS }}-dependencies-${{ hashFiles('\*\*/package-lock.json') }}
        restore-keys: |
          ${{ runner.OS }}-dependencies-${{ env.cache-name }}-
          ${{ runner.OS }}-dependencies-
          ${{ runner.OS }}-

    - name: Install dependencies
      run: npm ci

    - name: Test & publish code coverage
      uses: paambaati/[email protected]
      env:
        CC_TEST_REPORTER_ID: ${{ secrets.CC_TEST_REPORTER_ID }}
      with:
        coverageCommand: npm test
        coverageLocations: |
          client/coverage/lcov.info
          server/coverage/lcov.info
        debug: true

The lcov files do exist, and the jest tests run and pass fine.

Here's the debug log from the cc-test-reporter:

home/runner/work/StudentPortal/StudentPortal/cc-reporter format-coverage /home/runner/work/StudentPortal/StudentPortal/client/coverage/lcov.info -t lcov -o codeclimate.0.json --debug
time="2022-02-09T20:39:17Z" level=debug msg="coverage path /home/runner/work/StudentPortal/StudentPortal/client/coverage/lcov.info" 
time="2022-02-09T20:39:17Z" level=debug msg="using formatter lcov" 
time="2022-02-09T20:39:17Z" level=debug msg="checking search path /home/runner/work/StudentPortal/StudentPortal/client/coverage/lcov.info for lcov formatter" 
time="2022-02-09T20:39:19Z" level=debug msg="couldn't load committed at from ENV, trying git..." 
time="2022-02-09T20:39:19Z" level=info msg="trimming with prefix /home/runner/work/StudentPortal/StudentPortal/" 
time="2022-02-09T20:39:19Z" level=debug msg="getting fallback blob_id for source file components/index.ts" 
time="2022-02-09T20:39:19Z" level=error msg="failed to read file components/index.ts\nopen components/index.ts: no such file or directory" 
Error: open components/index.ts: no such file or directory
Usage:
cc-test-reporter format-coverage [coverage file] [flags]

Flags:
    --add-prefix string   add this prefix to file paths
-t, --input-type string   type of input source to use [clover, cobertura, coverage.py, excoveralls, gcov, gocov, jacoco, lcov, lcov-json, simplecov, xccov]
-o, --output string       output path (default "coverage/codeclimate.json")
-p, --prefix string       the root directory where the coverage analysis was performed (default "/home/runner/work/StudentPortal/StudentPortal")

Global Flags:
-d, --debug   run in debug mode

Error: The process '/home/runner/work/StudentPortal/StudentPortal/cc-reporter' failed with exit code 255
(node:2293) UnhandledPromiseRejectionWarning: Error: The process '/home/runner/work/StudentPortal/StudentPortal/cc-reporter' failed with exit code 255
  at ExecState._setResult (/home/runner/work/_actions/paambaati/codeclimate-action/v3.0.0/node_modules/@actions/exec/lib/toolrunner.js:592:25)
  at ExecState.CheckComplete (/home/runner/work/_actions/paambaati/codeclimate-action/v3.0.0/node_modules/@actions/exec/lib/toolrunner.js:575:18)
  at ChildProcess.<anonymous> (/home/runner/work/_actions/paambaati/codeclimate-action/v3.0.0/node_modules/@actions/exec/lib/toolrunner.js:469:27)
  at ChildProcess.emit (events.js:210:5)
  at maybeClose (internal/child_process.js:1021:16)
  at Process.ChildProcess._handle.onexit (internal/child_process.js:283:5)
(node:2293) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 2)
(node:2293) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
Error: 🚨 CC Reporter coverage formatting failed!

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions