我已经正确设置了 karma 配置,配置文件,在后台运行,非常好。我更改并保存文件后,它将重新运行测试...。所有750个单元测试。我希望能够只运行几个。缺少手动修改配置文件或注释掉许多文件中数百个测试的方法,有没有简单的方法可以做到这一点?
例如。当使用say mocha运行命令行服务器测试时,我只使用regexp:mocha -g 'only tests that I want'
。使调试和快速检查变得更加容易。
最佳答案
所以现在我觉得很愚蠢。 mocha支持非常狭窄的regexp匹配。
这将运行所有测试
describe('all tests',function(){
describe('first tests',function(){
});
describe('second tests',function(){
});
});
这仅运行“首次测试”
describe('all tests',function(){
describe.only('first tests',function(){
});
describe('second tests',function(){
});
});
你也可以做
it.only()
我应该已经注意到了。叹。
关于karma-runner - 如何仅在 karma 中运行某些测试?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/26603402/