本文介绍了摩卡描述未定义的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个名为MochaTests的目录.在里面,我在mocha网站上找到了示例测试"1.2.3摩卡".在命令提示符下(我的操作系统为WIN7),我键入Mocha,结果为"0 passing(2 m2)".我按照说明说的进行安装;npm install -g mocha ...据我所知,它安装得很好.因此,在c:\ MochaTests>中,我输入node然后输入.load test1.js,我得到ReferrneceError:describe未定义.可以帮忙.是的,我已经对它进行了搜索",但是这些结果不能解决我的问题在nodejs googlegroup上,有一篇12/24/12的帖子标题为"describe is not defined"(描述未定义)...他声称自己解决了我的问题",但没有提供任何有关清除此错误的详细信息.

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 problemOn 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.

推荐答案

tl; dr

您将要运行mocha而不是node:

npm install mocha -g

mocha

OLD(此帖子已被删除):

OLD (the post has since been removed):

这篇文章说在对我有用的命令中使用mocha而不是node:

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

这篇关于摩卡描述未定义的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-25 06:58