I want to use jest.runCLI()
in gulp
for executing only a changed test.
How can I do this?
How can I run just one test with jest.runCLI()
?
Jest 有一个 CLI 选项来仅运行更改的文件(基于 git 存储库状态)。命令行以jest --onlyChanged
编程方式变为:
jest.runCLI({'onlyChanged': true}, __dirname, function (success) {...});
使用终端,jest 使用非连字符选项来指定文件名:
jest test1
仅运行 test1.jsjest test1 test2
运行 test1.js 和 test2.jsjest-cli 使用optimist解析选项,非连字符选项映射到下划线选项 ( _
):
jest.runCLI({'_': ['test1']}, __dirname, function (success) {...});
仅运行 test1.jsjest.runCLI({'_': ['test1', 'test2']}, __dirname, function (success) {...});
运行 test1.js 和 test2.js