New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Missing Coverage with TravisCI, Jest #341

Closed
stevenAtGeneralUI opened this Issue May 30, 2018 · 6 comments

Comments

Projects
None yet
5 participants
@stevenAtGeneralUI

stevenAtGeneralUI commented May 30, 2018

I'm having trouble getting code coverage to be displayed through Code Climate. I have used the ---debug flag, and it appears to have successfully created and POSTed codeclimate.json.

I'm using Jest, which outputs lcov to ./coverage. From package.json:

"collectCoverage": true,
"coverageReporters": ["lcov"]

Here is my .travis.yml:

env:
  global:
    - CC_TEST_REPORTER_ID=ec3a169f7a2343e831cf13099e83f63e510fde66d7c1e94090cd57c868647ebb
language: node_js
node_js:
  - 9.4.0
cache:
  directories:
    - node_modules
before_script:
  - curl -L https://codeclimate.com/downloads/test-reporter/test-reporter-latest-linux-amd64 > ./cc-test-reporter
  - chmod +x ./cc-test-reporter
  - ./cc-test-reporter before-build
script:
  - npm run test:coverage
after_script:
  - ./cc-test-reporter after-build -t lcov --debug --exit-code $TRAVIS_TEST_RESULT

The after-build steps reports:
Test report uploaded successfully to Code Climate

In Code Climate the initial umbrella icon changed to a dashed line:
image

@stevenAtGeneralUI

This comment has been minimized.

stevenAtGeneralUI commented May 30, 2018

Here is some relevant info from --debug:

INFO[0000] trimming with prefix /home/travis/build/generalui/MyProject/ 
DEBU[0000] getting git blob_id for source file test_data/objectGenerators.tsx 
DEBU[0000] codeclimate.json content: {
  "ci_service": {
    "branch": "trying-to-fix-coverage-reporting",
    "build_identifier": "126730403",
    "build_url": "",
    "commit_sha": "db4ecdde8c223aa9830046434364d005c18e995d",
    "committed_at": 1527701381,
    "name": "true"
  },
  "environment": {
    "gem_version": "2.7.7",
    "package_version": "",
    "pwd": "/home/travis/build/generalui/MyProject",
    "prefix": "/home/travis/build/generalui/MyProject",
    "rails_root": "",
    "reporter_version": "0.6.0",
    "simplecov_root": ""
  },
  "git": {
    "branch": "trying-to-fix-coverage-reporting",
    "head": "db4ecdde8c223aa9830046434364d005c18e995d",
    "committed_at": 1527701381
  },
  "covered_percent": 17.333333333333336,
  "covered_strength": 0,
  "line_counts": {
    "missed": 3348,
    "covered": 702,
    "total": 4050
@davehenton

This comment has been minimized.

Contributor

davehenton commented Jun 1, 2018

Hey @stevenAtGeneralUI , sorry for the delay in getting to this. Taking a look our backend, I can confirm that we're receiving valid test payloads for your repo. However, we haven't yet received a payload from your default branch. Currently, we only display coverage info for the default branch in the UI. Coverage info for non-default branches is visible in Github by using our browser extension. Once you upload a coverage payload from your default branch, let me know if you're still failing to see that info as expected. Thanks.

@wfleming

This comment has been minimized.

Member

wfleming commented Sep 4, 2018

This issue hasn't received a reply in a while, closing due to staleness. Feel free to reply if this issue needs further action.

@wfleming wfleming closed this Sep 4, 2018

@ianpaschal

This comment has been minimized.

ianpaschal commented Sep 5, 2018

I believe I'm experiencing this issue as well.

I'm basing this off of the Travis CI set-up described here:
https://docs.codeclimate.com/docs/travis-ci-test-coverage

My travis.yml:

env:
  global:
    - CC_TEST_REPORTER_ID=575206a0cd09b1027a40c9a0fb71da087210b8ec433c80e9136a1345de5cc842
language: node_js
node_js:
  - "6"
cache:
  directories:
    - node_modules
install:
  - npm install
before_script:
  - curl -L https://codeclimate.com/downloads/test-reporter/test-reporter-latest-linux-amd64 > ./cc-test-reporter
  - chmod +x ./cc-test-reporter
  - ./cc-test-reporter before-build
script:
  - npm run lint
  - npm run test
  - npm run bundle
after_script:
  - ./cc-test-reporter after-build -t lcov --debug --exit-code $TRAVIS_TEST_RESULT

Doesn't seem to work at all; I just see the umbrella for configuring code coverage forever.

FYI the information on configuring code coverage is pretty buried. I was rather annoyed to click on the configure code coverage button and see my token and basically zero info on how to do it. For that, I had to go to the docs, and from there, I had to very carefully read to find a small link to examples and to find the Travis CI example. Which doesn't work. Bummer.

@davehenton

This comment has been minimized.

Contributor

davehenton commented Sep 5, 2018

Hey @ianpaschal, sorry about the poor surfacing of those Travis CI docs. I'll see where we can improve that experience.

To help troubleshoot your issue, do you mind writing into Code Climate Support with the name of the repo you're working with? I'll be standing by to look into this further.

@ianpaschal

This comment has been minimized.

ianpaschal commented Sep 5, 2018

@davehenton My opinion regarding the documentation is that if you click on set-up code coverage, you should see your token and a list of guides on how to use it. Experienced users then don't have to scroll/look down to get the token (what they came for) and inexperienced users will get straight to the info they need. Also, offering any settings to tweak the set-up when CC already knows it's not configured yet doesn't really make sense. But I digress. ;)

This seems to have "fixed itself."

I'm not sure of this but what seems to have been the case was: My code was failing because I had less than 80% coverage; when I tapered down what was being included to just the core src files and the code style passed, it showed up in CC. Either way the json was being sent (as told by the debug flag). It would seem to me that the coverage icon needs 3 states: not-set-up, failing, and passing-with-x-percent-coverage.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment