【问题标题】:WebStorm Mocha : tests are always pendingWebStorm Mocha:测试始终处于未决状态
【发布时间】:2017-04-13 08:58:46
【问题描述】:

我关注了有关如何在 WebStorm 中设置 Mocha 的 WebStorm 视频:

https://www.youtube.com/watch?time_continue=81&v=4mKiGkokyx8

我创建了一个非常简单的测试,通过和失败:

var assert = require("assert")
describe('Array', function() {
  describe('#indexOf()', function() {

    it('should return -'), function() {
      assert.equal(-1, [1,2,3].indexOf(5))
    }


    it('should fail'), function() {
      assert.equal(1, [1,2,3].indexOf(5))
    }
  })
})

然后我像这样设置运行配置:

然后我运行它。它只是声明测试“待定”,然后该过程完成:

为什么会这样?

【问题讨论】:

    标签: mocha.js webstorm


    【解决方案1】:

    您的两个测试都被忽略了,因为您使用了不正确的it() 语法。请尝试按以下方式更改您的套房:

    var assert = require("assert")
    describe('Array', function() {
        describe('#indexOf()', function() {
    
            it('should return -', function() {
                assert.equal(-1, [1,2,3].indexOf(5))
            })
    
    
            it('should fail', function() {
                assert.equal(1, [1,2,3].indexOf(5))
            })
        })
    }) 
    

    【讨论】:

      猜你喜欢
      • 2021-12-30
      • 2011-03-09
      • 2014-06-28
      • 1970-01-01
      • 2014-09-20
      • 2016-06-28
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多