如何动态地将上下文设置为mocha中的“it”块?(与describe类似)

时间:2015-03-03 12:17:18

标签: node.js mocha chai

它阻止不采用describe block的上下文。

for( var i =0 ;i< dynamicFunctions.length; i++){
  (function wrap(dynamicFunction){
    describe("condition", function(){
      // It is executing all functions sequentially one by one.
      // since it is executed before it
      dynamicFunction.apply(null)
      it("should execute", function(){
        // It is always executing last function of the array.
        // since dynamicFunction is referring to last element of the array.
        // how to executing all functions sequentially one by one
        // like how it executes outside it block
        dynamicFunction.apply(null);
      }
    })
  }(dynamicFunctions[i]));
}

如何使用不同的函数运行它,比如它在块外执行的方式?

0 个答案:

没有答案