我正在使用 TypeScript、Jest 和ts-jest
NPM 模块。
当我运行测试时,我确实获得了一定的覆盖范围,但 HTML 报告不太正确:
此外,某些函数被标记为未经测试,即使它们确实被调用。
我的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"
]
}
}
我的配置有问题吗?
UPDATE
从jest@20开始你可以通过地图覆盖范围 https://facebook.github.io/jest/docs/en/configuration.html#mapcoverage-boolean选项和使用coverage/lcov-report/index.html
file.
OLD
我也一直在努力解决这个问题,但后来我注意到那条线 https://github.com/kulshekhar/ts-jest/blob/master/src/coverageprocessor.ts#L75.
长话短说——报道报道去coverage/remapped/html/index.html
file.
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)