On Mon, Dec 24, 2012 at 12:18 AM, Artur Vinogradov <[email protected]
> wrote:
> I installed mocha with -g parameter, though it's not been working for me
> with other modules: I always had to link them, so that i can require them.
>
It looks like you're not starting mocha properly. You shouldn't have that
require of 'mocha' in there, and you need to be starting this using 'mocha'
on the command line.
The thing with mocha is that it doesn't just require your test module. It
loads it into a special context, which is where global functions like
'describe' come from. In your case, 'describe' is not defined almost
certainly because mocha was not started properly.
--
Martin Cooper
This is my code:
>
> var Mocha = require('mocha');
>
> var assert = require("assert")
> describe('Array', function(){
> describe('#indexOf()', function(){
> it('should return -1 when the value is not present', function(){
> assert.equal(-1, [1,2,3].indexOf(5));
> assert.equal(-1, [1,2,3].indexOf(0));
> })
> })
> })
>
> ReferenceError: describe is not defined
> at Object.<anonymous> (/home/user/mocha/prog.js:3:1)
> at Module._compile (module.js:449:26)
> at Object.Module._extensions..js (module.js:467:10)
> at Module.load (module.js:356:32)
> at Function.Module._load (module.js:312:12)
> at Module.runMain (module.js:492:10)
> at process.startup.processNextTick.process._tickCallback
> (node.js:244:9)
>
> --
> Job Board: http://jobs.nodejs.org/
> Posting guidelines:
> https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines
> You received this message because you are subscribed to the Google
> Groups "nodejs" group.
> To post to this group, send email to [email protected]
> To unsubscribe from this group, send email to
> [email protected]
> For more options, visit this group at
> http://groups.google.com/group/nodejs?hl=en?hl=en
>
--
Job Board: http://jobs.nodejs.org/
Posting guidelines:
https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines
You received this message because you are subscribed to the Google
Groups "nodejs" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/nodejs?hl=en?hl=en