Error processing coverage reports with Jest and Github Action

Description

I just spun up a new project and am uploading JavaScript test coverage reports (generated by Jest) to Codecov using the action for GitHub Actions. In my project I’m not seeing any data, just a generic “There was an error processing coverage reports” error.

Repository

(The application being tested is in the frontend directory - I’m suspicious that this is part of the issue, and I’ve tried to fix paths, via the docs on fixing paths, but nothing has worked.

Versions

Chrome 78, macOS Mojave, but I doubt this is relevant

More importantly:
jest-cli@24.9.0
codecov/codecov-action@v1

Additional Information

Zipfile of the reports generated with Jest: https://files.bjacobel.com/coverage.zip

Codecov GH Actions logs: (inlined below)

Run codecov/codecov-action@v1
bash codecov.sh -n  -F  -y codecov.yml

  _____          _
 / ____|        | |
| |     ___   __| | ___  ___ _____   __
| |    / _ \ / _` |/ _ \/ __/ _ \ \ / /
| |___| (_) | (_| |  __/ (_| (_) \ V /
 \_____\___/ \__,_|\___|\___\___/ \_/
                              Bash-20191203-57b854c


==> GitHub Actions detected.
    project root: .
--> token set from env
    Yaml found at: codecov.yml
sed: can't read ./codecov.yml: No such file or directory
==> Running gcov in . (disable via -X gcov)
==> Python coveragepy not found
==> Searching for coverage reports in:
    + .
    -> Found 3 reports
==> Detecting git/mercurial file structure
==> Reading reports
    + ./coverage/clover.xml bytes=9580
    + ./coverage/coverage-final.json bytes=21994
    + ./coverage/lcov.info bytes=4242
==> Appending adjustments
    http://docs.codecov.io/docs/fixing-reports
    -> No adjustments found
==> Gzipping contents
==> Uploading reports
    url: https://codecov.io
    query: branch=frontend&commit=b341efe45de1becb0bfd8eab6c07c47fb302bc82&build=&build_url=&name=&tag=&slug=bjacobel%2Fepstein&service=github-actions&flags=&pr=&job=
    -> Pinging Codecov
https://codecov.io/upload/v4?package=bash-20191203-57b854c&token=secret&branch=frontend&commit=b341efe45de1becb0bfd8eab6c07c47fb302bc82&build=&build_url=&name=&tag=&slug=bjacobel%2Fepstein&service=github-actions&flags=&pr=&job=
    -> Uploading
    -> View reports at https://codecov.io/github/bjacobel/epstein/commit/b341efe45de1becb0bfd8eab6c07c47fb302bc82

Hi @bjacobel

First, this is a beautiful bug report that has everything I need to be able to help, thank you!

Second, let’s take a look here.

Here’s the raw report you uploaded: codecov.io/codecov/v4/raw/2019-12-11/4F241C9D464AC4CA61BEDEFCC7BC8DB6/b341efe45de1becb0bfd8eab6c07c47fb302bc82/6a4736cf-0186-4aa6-a785-4e63f6dd4ba4.txt

It looks like the uploader wasn’t run in the correct directory since the network section (the files listing) only contains coverage files. Ideally the uploader should be run from the repo root.

Without those files, we can’t match to the coverage report and thus we consider the report empty and fail the processing.

Thanks for the response!

I’ve resolved the issue - I didn’t realize the repository’s source files needed to be on disk during the Codecov upload step (I thought they just were obtained directly from GitHub or something!). My Github Actions step for Codecov was running at a point where the source files had already been removed from the workspace - only the coverage artifacts were present. By reorganizing things to make sure that both source files and coverage assets were present when the upload steps run, it is now working.

1 Like