在Ruby Rspec中,我们可以按如下方式指定标签:
it "test 1" :production => true do
# test something
end
然后,您可以使用--tag production
选项过滤要运行的测试。
我想知道Nodejs中的Mocha是否有类似的东西?如果没有,那么实现这一目标的好方法是什么。到目前为止,我只能考虑在标题中添加特定模式并使用--grep
选项。
编辑:
我最终使用https://github.com/visionmedia/mocha/wiki/Tagging,
it("test 1 @production", function (done) {
// test something
})
然后使用--grep @production
选项运行。
唯一的缺点是@production是标题的一部分,这使报告不那么干净,特别是如果你有标签。