question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Bug: Jest and TravisCI "X Failed to read file at"

See original GitHub issue

Describe the bug Running codecov from TravisCI yields X Failed to read file at when locating files even when coverage folder exists in the same level. Works when passing -f ./coverage/clover.xml though.

I tried pwd before running codecov and apparently travis cds into the project folder, meaning that running codecov should allow it to easily locate coverage using relative paths such as ./coverage without having to pass it manually.

To Reproduce Steps to reproduce the behavior:

  1. Configure travis to run jest to output coverage to coverage folder
  2. Set after_success to codecov

Expected behavior Should easily locate coverage reports when available relative to project root.

Screenshots Failing build: Travis Failing Build Report Passing build: Travis Passing Build Report

Additional context Full passing .travis.yml configuration (remove -f ./coverage/clover.xml to make it fail):

language: node_js
node_js:
  - '12.16.0'
scripts:
  - npm install -g codecov
  - npm run build
before_deploy:
  - if [ "$TRAVIS_BRANCH" = "development" ]; then npm run alpha; fi
  - if [ "$TRAVIS_BRANCH" = "master" ]; then npm run release; fi
cache:
  directories:
    - node_modules
deploy:
  provider: npm
  cleaup: false
  skip_cleanup: true
  on:
    tags: true
branches:
  only:
    - master
    - development
after_success:
  - codecov -f ./coverage/clover.xml # remove -f ./coverage/clover.xml to make it fail

Full jest.config.js configuration:

module.exports = {
	testEnvironment: 'node',
	setupFilesAfterEnv: ['jest-extended'],
	coverageDirectory: './coverage',
	collectCoverage: true
};

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Reactions:8
  • Comments:27 (9 by maintainers)

github_iconTop GitHub Comments

6reactions
yhattcommented, Jul 18, 2020

I also have met the same in CircleCI. It’s getting back to normal behavior by downgrading to v3.7.0, so probably there are any breaks in the latest v3.7.1. https://github.com/codecov/codecov-node/compare/v3.7.0...v3.7.1

4reactions
thomasrockhucommented, Jul 22, 2020

Hi everyone and sorry for the delay here. We really appreciate all the conversation, and we are investigating the outage. Thanks @yhatt for this PR. If it looks good, we’ll merge and push a new version 3.7.2

Read more comments on GitHub >

github_iconTop Results From Across the Web

Travis CI Fail Jest testing for Timeout reason - Stack Overflow
I just found out the solution by reading the Jest documentation. Since the errors are only in Travis CI, I assumed that their...
Read more >
Common Build Problems - Travis CI Docs
If your build is failing due to unexpected segmentation faults in the language interpreter, this may be caused by corrupt or invalid caches...
Read more >
Troubleshooting - Jest
Troubleshooting. Uh oh, something went wrong? Use this guide to resolve issues with Jest. Tests are Failing and You Don't Know Why​.
Read more >
Wrong coverage percentage - Bug Fixes - Codecov
As can be seen on it, the original source file has 100% coverage, but there is a strange copy of the same file...
Read more >
Node.js v19.3.0 Documentation
readFile (path[, options]); fsPromises.readlink(path[, options]) ... A subclass of Error that indicates the failure of an assertion.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found