`before`钩子代替测试用例(`it`)

时间:2018-12-13 15:57:31

标签: mocha

摩卡咖啡是否不允许在it测试用例中插入钩子?

我尝试了以下操作,但似乎从未执行:

describe('Array', () => {

  before(async () => {
      // do some async stuff before any test cases in this suite run
      // THIS RUNS OK
  });

  it('should blah', async () => {
      before(async () => {
          // do some async stuff just before this test case
          // THIS NEVER RUNS!!!!!!!!!!!!!!!!!!!!!!
      });

      // blah
  );

});

before中的describe运行,但是before内的it无法运行。

0 个答案:

没有答案