茉莉花避免每次都进行某些测试 [英] Jasmine avoid beforeEach for certain tests
本文介绍了茉莉花避免每次都进行某些测试的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
有没有一种方法不能仅对某些测试('it'块)执行beforeEach函数.可以说我有10个it块,我不希望对其中两个块执行beforeEach.有可能吗?
Is there a way to NOT execute beforeEach function only for certain tests ('it' blocks). Lets say I have 10 it blocks, I do not want beforeEach to be executed for two of the blocks. Is it possible?
推荐答案
您可以将要与beforeEach一起运行的规范分组到单独的describe
中:
You can group specs which you want to run with beforeEach into a separate describe
:
it('should 1...', function () {});
it('should 2...', function () {});
describe('group', function () {
beforeEach(function () {
// ...
});
it('should 3...', function () {});
it('should 4...', function () {});
// ...
});
这篇关于茉莉花避免每次都进行某些测试的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文