Search code examples
javascriptnode.jstravis-cinyccodecov

nyc report is not uploaded to Codecov in TravisCI build


I have configured codecov to my NodeJS application.

When I run the npm run codecov --disable=gcov it generates the reports and I can see the results. But in my TravisCI build, I get a message in the log as

X Failed to read file at

==> Scanning for reports
    X Failed to read file at 

Here is how my package.json looks like.

"report-coverage": "nyc report --reporter=text-lcov --recursive \"./spec/**/*.spec.js\" > coverage.lcov && codecov",
"coverage": "codecov --disable=gcov"

Here is the package.json

Here is the link for TravisCI build log.


Solution

  • It was because I did not run npm run test before npm run coverage

    So, I have changed my after_success: in travis.yml as follows:

    after_success: npm run test && npm run coverage