Test does not show transmission when using

I am testing for the first time, writing a test case

var should = require("should") describe('Array', function(){ describe('#indexOf()', function(){ it('should return -1 when the value is not present',function(){ [1,2,3].indexOf(5).should.equal(-1); [1,2,3].indexOf(0).should.equal(-1); }) }) }) 

it gives me 0 walkthrough

  0 passing (1ms) 

but why should he show 1 pass

+8
unit-testing mocha
source share
1 answer

By default, if no parameters are specified, mocha searches the directory. / test.

If you saved the test above in another place (maybe in the current directory), you must specify the path to this file as a parameter for mocha.

Assuming the test is saved in the test.js file, you should run it as follows:

 % mocha test.js ․ 1 passing (5ms) 
+5
source share

All Articles