使用时,testing不显示通过
我第一次testing我写一个testing用例
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); }) }) })
它给我0通过
0 passing (1ms)
但为什么它应该显示1通过
默认情况下,如果没有提供参数,mocha正在查找./test目录。
如果您将testing保存在其他地方(可能位于当前目录中),则应提供此文件的path作为摩卡的参数。
假设testing被保存在一个文件test.js中 ,你应该执行它如下:
% mocha test.js ․ 1 passing (5ms)