相关疑难解决方法(0)

循环摩卡测试?

我正在尝试循环一个mocha测试套件(我想针对无数的值测试我的系统与预期的结果),但我无法让它工作.例如:

spec/example_spec.coffee:

test_values = ["one", "two", "three"]

for value in test_values
  describe "TestSuite", ->
    it "does some test", ->
      console.log value
      true.should.be.ok
Run Code Online (Sandbox Code Playgroud)

问题是我的控制台日志输出如下所示:

three
three
three
Run Code Online (Sandbox Code Playgroud)

我希望它看起来像这样:

one
two
three
Run Code Online (Sandbox Code Playgroud)

如何为我的mocha测试循环这些值?

mocha.js node.js

10
推荐指数
1
解决办法
7489
查看次数

标签 统计

mocha.js ×1

node.js ×1