nyc coveralls integration not working

1.5k views Asked by At

I try to make nyc working with coveralls following the instruction: https://github.com/istanbuljs/nyc#integrating-with-coveralls

But I can't get it to work. Here is an example repo: https://github.com/unional/showdown-highlightjs-extension

Travis build is successful: https://travis-ci.org/unional/showdown-highlightjs-extension

And Coveralls notice the build, but does not seem to get any data: https://coveralls.io/github/unional/showdown-highlightjs-extension

Here is my .travis.yml:

language: node_js

notifications:
  email:
    on_success: never
    on_failure: change

node_js:
  - "stable"

before_install:
  - npm install -g npm

script:
  - npm run verify

after_script:
  - 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": [
      "scripts",
      "**/*.spec.*",
      "**/fixtures/**/*"
    ]
  },
  ...
}
2

There are 2 answers

0
unional On BEST ANSWER

I found out the issue is in my tsconfig.json:

{
  "compilerOptions": {
    "sourceRoot": "/showdown-highlight-extension"
    ...
  }
}

This setting gives me the correct (I assume) source map in the browser. See What's the proper way to set sourceRoot in typescript?

image

But is not liked by the coverage tool.

Once I remove it, it starts working.

Need to find an answer to that question.

9
ocean On

Try adding your Coveralls repo API token (which can be found on the Coveralls page for your repo) to a new COVERALLS_REPO_TOKEN encrypted environment variable on Travis, as per the (somewhat sketchy) documentation on the Coveralls site.