DEV Community

Cover image for Paralleling Code Coverage using Coveralls and Travis
Montana Mendy
Montana Mendy

Posted on

Paralleling Code Coverage using Coveralls and Travis

Hey developer friends,

A short one today -- but an important one.

Let's say you have multiple environments you want to have coverage, first let's enable Coveralls for your repo, so if you haven't done so yet -- head over to coveralls.io and Auth the Coveralls app to up your GitHub account, and then sync your repos with Coveralls.

You'll want to have a .travis.yml file that looks similar to mine:

sudo: false
language: node_js
node_js:
  - "node"
env:
  global:
    - COVERALLS_PARALLEL=true
jobs:
  include:
    - script: COVERALLS_FLAG_NAME=test-1 make test-coveralls-1
    - script: COVERALLS_FLAG_NAME=test-2 make test-coveralls-2
notifications:
  webhooks: https://coveralls.io/webhook
Enter fullscreen mode Exit fullscreen mode

You'll see we are running multiple COVERALLS_FLAG_NAME, this is using the Coveralls webhook to parallelize your coverage. If at first you don't see Coveralls covering your code, you may want to add your env var from Coveralls to Travis CI and name it something like COVERALLS_TOKEN.

Image description

Here's my repo so you can follow step by step! https://github.com/Montana/coveralls-node-travis

Top comments (0)