angulartravis-ciistanbulkarma-coveragecoveralls

How to set up coveralls in an Angular GitHub + TravisCI project


In my Angular project hosted on GitHub, I'm running the tests in TravisCI using:

package.json scripts

 "test-ci": "ng test --watch=false"

.travis.yml script

script:
  - ng lint
  - npm run test-ci
  - npm run e2e
  - npm run build

I would like to set up coveralls, however from the official documentation and articles on the web it is not super clear what I have to do.


Solution

  • I solved by simply using node-coveralls.

    What I had to do was just installing it:

    npm install coveralls --save-dev
    

    And then in my package.json scripts change:

     "test-ci": "ng test --watch=false"
    

    to:

     "test-ci": "ng test --watch=false --code-coverage && cat ./coverage/lcov.info | coveralls"