Jest,Typescript,ts-jest:覆盖率稍微不正确
我正在使用TypeScript,Jest和ts-jest
NPM模块来编写项目。
当我运行我的testing,我得到了一些覆盖面,但HTML报告是不正确的:
此外,一些function即使被称为是未经testing也被标记为未经testing。
我的package.json设置如下:
{ "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" ] } }
我的configuration有问题吗?
UPDATE
从jest @ 20开始,您可以传递mapCoverage选项并使用coverage/lcov-report/index.html
文件。
旧
我也一直在努力解决这个问题,但是我注意到了这一点 。
长话短说 – 覆盖报告进入coverage/remapped/html/index.html
文件。