16

I am wrtiting a project using TypeScript, Jest and the ts-jest NPM module.

When I run my test, I do get some amount of coverage, but the HTML report is not quite right:

Code coverage issues

Furthermore, some functions are being marked as untested even though they are certainly being called.

My package.json is set as follows:

{
    "jest": {
    "transform": {
      ".(ts|tsx)": "<rootDir>/node_modules/ts-jest/preprocessor.js"
    },
    "testRegex": "(/__tests__/.*|\\.(test|spec))\\.(ts|tsx|js)$",
    "moduleFileExtensions": [
      "ts",
      "tsx",
      "js"
    ],
    "testResultsProcessor": "<rootDir>/node_modules/ts-jest/coverageprocessor.js",
    "collectCoverage": true,
    "collectCoverageFrom": [
      "src/**/*.{ts,tsx}"
    ],
    "coverageReporters": [
      "html",
      "json"
    ]
  }
}

Is something wrong with my configuration?

2
  • 2
    Did you look in coverage/remapped/html/index.html?
    – Umidbek
    Mar 29, 2017 at 15:10
  • THANK YOU! Can you post this as a response so that I can mark this as the correct answer?
    – Rick
    Mar 30, 2017 at 13:01

1 Answer 1

5

UPDATE

Starting from jest@20 you can pass mapCoverage option and use coverage/lcov-report/index.html file.

OLD

I also have been struggling with this problem, but then I notice that line.

Long story short - coverage reports goes to coverage/remapped/html/index.html file.

5

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.