Mocha describe is not defined [duplicate]

倖福魔咒の 提交于 2019-12-21 09:28:43

问题


I have a directory called MochaTests. Inside there I have the example test found on the mocha website "1.2.3 Mocha". At the command prompt(My OS is WIN7), I type in Mocha, and the result is "0 passing(2 m2)". I installed just like the instructions say; npm install -g mocha...from what I can tell it installs just fine. So, in c:\MochaTests> I type node then I type .load test1.js I get ReferrneceError: describe is not defined. Can some help. And yes, I have "googled" it already but those results don't fix my problem On the nodejs googlegroup there is a post dated 12/24/12 that is titled "describe is not defined"...He claims he "solved my problems" but did oot provide any details about what he did to clear up this error.


回答1:


tl;dr

You'll want to run mocha instead of node:

Install Mocha (globally)

npm install mocha -g

Then, run mocha

mocha

OLD (the post has since been removed):

This post says to use mocha instead of node in your command which works for me:

http://comments.gmane.org/gmane.comp.lang.javascript.nodejs/58313



来源:https://stackoverflow.com/questions/18430135/mocha-describe-is-not-defined

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!