我正在使用 jest cli运行我的测试。 Jest 有一个名为 --runTestsByPath
的 cli 选项我用它来指定我的测试位置。
我的单元测试分布在我存储库的不同目录中,但我想在一个命令中运行它们。一种选择是 &&
不同的 Jest 命令:
{
"name": "node-project",
"version": "0.0.0",
"scripts": {
"test": "jest --runTestsByPath ./__tests__/tests/over/here/*_test.ts && jest --runTestsByPath ./tests/over/__tests__/here/*_test.ts",
},
"devDependencies": {
"jest": "24.8.0",
"ts-jest": "24.0.2",
"ts-node": "8.3.0",
"typescript": "2.9.2"
}
}
但是,然后我失去了通过 1 个 jest 命令运行它们所获得的覆盖率等功能。
我想知道,因为它没有在任何地方记录,也没有在 SO 上回答,我如何将两个或更多不同的路径传递给 --runTestsByPath
?
最佳答案
我们可以将多个路径传递给 jests --runTestsByPath
cli 选项:
jest --runTestsByPath ./__tests__/tests/over/here/*_test.ts ./tests/over/__tests__/here/*_test.ts
关于javascript - Jest --runTestsByPath 两个或多个不同的路径,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/57527660/