NYC coveralls integration not working

Here is my .travis.yml :

language: node_js

    on_success: never
    on_failure: change

  - "stable"

  - npm install -g npm

  - npm run verify

  - npm install coveralls && npm run coveralls

And here is my package.json :

  "scripts": {
    "coverage": "npm test && nyc check-coverage --branches 85 --functions 85 --lines 85",
    "coveralls": "nyc report --reporter=text-lcov | coveralls",
    "test": "npm run clean && tsc && nyc ava"
  "nyc": {
    "exclude": [

Hey @Spineswitch,

When it comes to nyc, your package.json looks just fine, it’s more to do with your .travis.yml config when I look at it all in aggregate.

I just made this repository today, you’d find it of great use probably: GitHub - Montana/travis-nyc: Travis w/ nyc by Montana Mendy.

The .travis.yml I coded out is more instructional and declarative based, for example:

  - docker
language: node_js
  - 17
  - npm init --yes
  - npm i express mocha chai supertest nyc mongoose
  - sudo apt-get install gnupg
  - wget -qO - | sudo apt-key add -
  - sudo apt-get install -y mongodb-org
  - sudo systemctl start mongod
  - node bin/www & 
  - npm install -g nyc
  - nyc --version 
  - nyc npm run test

It’s very straight forward, in this scenario - I made a quick app in JavaScript, gave it mock MongoDB credentials, had it connect to Mongo with node bin/www &, and you can see where I fetched nyc, etc. This worked out perfectly for me. This doesn’t cover coveralls I understand, but same implementation of coveralls would apply. Get the environment variables from coveralls add them in Travis, and you’d have more code coverage.

For one of my projects using nyc and coveralls this is a snippet of my travis.yml that maybe can help you:

    - script: COVERALLS_FLAG_NAME=test-1 make test-coveralls-1
    - script: COVERALLS_FLAG_NAME=test-2 make test-coveralls-2
    - script: npm install coveralls nyc --save-dev
after_success: npm run coverage

This is a private repo so I can only give you this snippet but should point you in the right direction.

1 Like

thank you so much @montana! this worked perfectly

Hey @Spineswitch,

No problem.

1 Like