codeclimate / test-reporter

Code Climate Test Reporter
MIT License
154 stars 76 forks source link

Missing coverage with nyc (JavaScript) #294

Closed jennydaman closed 6 years ago

jennydaman commented 6 years ago

I'm new to JS testing, and I'm trying to configure code coverage for my project. I'm using babel, mocha, nyc (and Travis).

For demonstration, I have a very basic JavaScript function here: https://github.com/jennydaman/mindmatter/blob/master/extension/js/lib/testTest.js And a test here: https://github.com/jennydaman/mindmatter/blob/master/test/toggle.test.js

mocha test is successful, nyc generates lcov report. cc-test-coverage after-build reports "Test report uploaded successfully to Code Climate". But nothing is registered on codeclimate.com...

Looking at the FAQ, I can't figure out what's wrong. https://docs.codeclimate.com/docs/test-coverage-troubleshooting-tips#section-common-questions-faqs Partially because I don't understand what it means.

  1. Possibly due to malformed payloads.
  2. Make sure that you're sending ENV (not Git) values.
  3. Check to see if you're pinning to a specific test coverage reporter version.

Maybe Travis would handle the issue regarding ENV values, though I still get this warning:

couldn't load committed at from ENV, trying git...

Travis log here: https://travis-ci.org/jennydaman/mindmatter/jobs/336847412

Coverage seems to work with Codacy and codecov, just not Code Climate :disappointed:

ale7714 commented 6 years ago

👋 @jennydaman! Thank you for using the test-reporter. I'm sorry you're encountering issues. Happy to help out and get you up and running.

Looking at your Travis file, I noticed that you were using the --prefix flag on after-build but I don't think that was pointing to root directory where the tests ran. I opened a PR that removes the use of this flag and confirmed that we're receiving the coverage correctly. Once merge, you should be able to see coverage results on our website or in the extension. Let me know if you have any questions.

jennydaman commented 6 years ago

I'm on my phone, merged hoping for the best... Fixed! Thanks so much for being friendly, guess I just didn't understand the doc.

ale7714 commented 6 years ago

@jennydaman any suggestions you might have for our docs feel free to share them with us. We're always looking to improve our docs.