如何使用笑话模式匹配调用所有测试一个文件夹中?
我有我的正常的单元测试与我的服务文件夹
现在,我创建新的文件夹名为integration/
和该文件夹中的所有我的测试看起来像anotherFolder/testSomeApi.integration.js
我这样做,这样,当我打电话node jest
,它运行所有的单元测试,但没有集成测试。我想从我的使用单独的命令泊坞窗容器中调用的集成测试
我怎么能叫像jest *integration.js
使得与扩展integration.js
集成文件夹中所有的测试被调用?
里面您的集成文件夹中创建了玩笑一个配置文件,如开玩笑,integration.json
{
"rootDir": ".",
"testEnvironment": "node",
"testRegex": ".integration.js$",
}
现在你可以从你的项目的根这样运行笑话:
jest --config ./integration/jest-integration.json
您可以将该行保存为您的package.json的NPM脚本,并使用它像
npm run test:integration
。