有没有办法只针对某些测试(“it” block )不执行 beforeEach 函数。假设我有 10 个 it block ,我不希望为其中两个 block 执行 beforeEach。可能吗?
最佳答案
您可以将要与 beforeEach 一起运行的规范分组到单独的 describe
中:
it('should 1...', function () {});
it('should 2...', function () {});
describe('group', function () {
beforeEach(function () {
// ...
});
it('should 3...', function () {});
it('should 4...', function () {});
// ...
});
关于Jasmine 在某些测试中避免 beforeEach,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31182170/