简体   繁体   English

摩卡错误:未定义不是构造函数(正在评估)

[英]Mocha error: undefined is not a constructor (evaluating)

I have this line of code in my unit testing function with Mocha + Chai: 我在Mocha + Chai的单元测试功能中有以下代码行:

const result = <div>Hello</div>
getHelloDiv().should.be.equal.to(result)

But when I run Mocha, I get: 但是当我运行Mocha时,我得到:

undefined is not a constructor (evaluating 'getHelloDiv().should.be.equal.to(result)')

Correcting this: 更正此:

getHelloDiv().should.be.equal.to(result)

to this: 对此:

getHelloDiv().should.equal(result)

solved the issue. 解决了这个问题。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 TypeError:未定义不是构造函数(评估“ casper.done()”)错误 - TypeError: undefined is not a constructor (evaluating 'casper.done()') error PhantomJS 错误:TypeError: undefined 不是构造函数(评估 &#39;require(&#39;system&#39;).create()&#39;) - PhantomJS error: TypeError: undefined is not a constructor (evaluating 'require('system').create()') TypeError:'undefined'不是构造函数(评估'new JdRes()) - TypeError: 'undefined' is not a constructor (evaluating 'new JdRes()) undefined 不是构造函数(评估“new _auth.PhoneAuthProvider()”) - undefined is not a constructor (evaluating 'new _auth.PhoneAuthProvider()') 音频如何无法在Safari中播放,并给我一个错误“未定义”不是构造函数(评估“新音频()”)” - How come Audio does not play in Safari and gives me an error ''undefined' is not a constructor (evaluating 'new Audio()')' 错误:undefined 不是 object(评估“来源”) - Error : undefined is not an object (evaluating 'source') undefined不是PhantomJS上具有Array.prototype.find的Mocha / Chai / Sinon中的构造函数 - undefined is not a constructor in Mocha / Chai / Sinon on PhantomJS with Array.prototype.find Vue Karma Mocha 单元测试 undefined 不是构造函数 querySelector - Vue Karma Mocha Unit Test undefined is not a constructor querySelector (React-Native)undefined不是评估&#39;new FormData()&#39;的构造函数 - (React-Native) undefined is not a constructor evaluating 'new FormData()' 例外:TypeError:未定义不是Ionic 2中的对象(评估“ pipe.constructor”)吗? - EXCEPTION: TypeError: undefined is not an object (evaluating 'pipe.constructor') in Ionic 2?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM