admin管理员组文章数量:1421492
Is there a way to make Mocha run tests in strict mode when running on node?
Normally you can enable this in node by running node --use_strict
. Is there a way to do the same thing for mocha
?
Is there a way to make Mocha run tests in strict mode when running on node?
Normally you can enable this in node by running node --use_strict
. Is there a way to do the same thing for mocha
?
-
The accepted answer is clearly wrong (it doesn't do the same thing as
node --use_strict
. Please consider accepting the other (upvoted) one. – Tad Lispy Commented Mar 24, 2017 at 13:06
3 Answers
Reset to default 10Add --use_strict
to the mocha mand.
So your mand might look like this :
mocha ./test --recursive --use_strict
There is no way to pass --use_strict into mocha and this was done in purpose. Read the discussion for details.
If you really want this behaviour you could fork mocha's sources or load this npm module as a first thing in your tests.
I would just start test scripts with
'use strict';
本文标签: javascriptMaking mocha quotuse strictquot when running in nodeStack Overflow
版权声明:本文标题:javascript - Making mocha "use strict" when running in node - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1745348147a2654594.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论