Search code examples
travis-ciistanbulcoverallsava

nyc coveralls integration not working


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/**/*"
    ]
  },
  ...
}

Solution

  • 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.