jeudi 2 juin 2016

Jest JS Test Coverage Data Not Posting to Code Climate from Codeship

I have a Node.js based project in which I am using Jest for .js unit-testing. I have the collectCoverage config setting set to true and can see the test coverage table in my local development runs and when the build is run in Codeship.

However, I can't seem to get the setup correct for getting the test coverage data to post to Code Climate to have the results displayed there.

I saved the repo token given in CodeClimate's setup instructions into a Codeship environment variable, as follows:

CODECLIMATE_REPO_TOKEN=xxxxxxxxxx codeclimate-test-reporter < lcov.info

Given that locally, the Jest collectCoverage saves the lcov.info data file in a directory called coverage in the root of my project, I also have tried a variation of the environment variable with that path, as such:

CODECLIMATE_REPO_TOKEN=xxxxxxxxxx codeclimate-test-reporter < coverage/lcov.info

For the installation of the codeclimate-test-reporter node module (npm install -g codeclimate-test-reporter), it's not clear to me from the instructions exactly where it should go. I've tried putting it:

  • in the Codeship test settings setup commands section just before the general npm install command,
  • in the Codeship test pipeline configuration commands section,

I have also tried installing it as a local dev dependency in my package.json.

No combination of the above attempts at setting things up has resulted in seeing anything on the Code Climate side regarding the test coverage.

As a final note about what I've done, I have not committed my local coverage directory, so it is not included in my Codeship build.

Can anyone help me figure out what I'm doing wrong?

Aucun commentaire:

Enregistrer un commentaire