根据should.js Spec这应该有效:
should.strictEqual(shape.code, code)
但我得到:
TypeError: Object #<Object> has no method 'strictEqual'
我错过了什么?
最佳答案
文档中似乎有错误。定义等于
in the script作为“严格等于”:
/**
* Assert strict equal.
*
* @param {Mixed} val
* @param {String} description
* @api public
*/
equal: function(val, desc){
this.assert(
val.valueOf() === this.obj
, 'expected ' + this.inspect + ' to equal ' + i(val) + (desc ? " | " + desc : "")
, 'expected ' + this.inspect + ' to not equal ' + i(val) + (desc ? " | " + desc : "")
, val);
return this;
},
...并且 strictEqual
未出现在脚本中。
关于mocha.js - 为什么should.js中的 "should.strictEqual"不起作用?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10834662/