Oliver Watkins
Oliver Watkins

Reputation: 13509

WebStorm Mocha : tests are always pending

I followed the WebStorm video on how to setup Mocha in WebStorm:

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

I created a very simple test with a pass and a fail:

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))
    }
  })
})

I then setup a run configuration like this:

enter image description here

And then I run it. It just states that the tests are 'pending' and then the process completes:

enter image description here

Why is this happening?

Upvotes: 0

Views: 1241

Answers (1)

lena
lena

Reputation: 93748

Your both tests are ignored, because you are using incorrect it() syntax. Please try changing your suite as follows:

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))
        })
    })
}) 

Upvotes: 4

Related Questions