【发布时间】:2021-03-04 22:46:06
【问题描述】:
我正在使用 Jest 对我的后端进行单元测试。我为开玩笑制作了一个虚拟文件进行测试,它工作正常,但在覆盖率报告中没有读取我的其他文件。覆盖率报告只是空的。我是不是对 jest 的配置做错了什么?
这是我的包 JSON 文件:
"name": "backend",
"version": "1.0.0",
"description": "",
"main": "seeder.js",
"scripts": {
"test": "jest",
"start": "node server.js",
"coverage": "npm test -- --coverage"
},
"author": "",
"license": "ISC",
"dependencies": {
"jest": "^26.6.3",
"supertest": "^6.1.3"
},
"jest": {
"testEnvironment": "node",
"coveragePathIgnorePatterns": [
"/node_modules"
]
}
}
【问题讨论】: