【发布时间】:2017-05-02 11:47:56
【问题描述】:
我正在使用 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"
]
}
}
我的配置有问题吗?
【问题讨论】:
-
你看
coverage/remapped/html/index.html了吗? -
谢谢!您能否将其发布为回复,以便我将其标记为正确答案?
标签: node.js typescript jestjs