The SitePoint Forums have moved.

You can now find them here.
This forum is now closed to new posts, but you can browse existing content.
You can find out more information about the move and how to open a new account (if necessary) here.
If you get stuck you can get support by emailing forums@sitepoint.com

If this is your first visit, be sure to
check out the FAQ by clicking the
link above. You may have to register
before you can post: click the register link above to proceed. To start viewing messages,
select the forum that you want to visit from the selection below.

Output from that command

THead, Cygwin is not the easiest thing to deal with. Although not idiomatic you can try running mocha directly:

Code:

C:\NODEJS1\chapter02>.\node_modules\.bin\mocha -u tdd

What happens when you try the above? If that still fails as per AussieJohn's suggestion, if you post the contents of your exchange.test.js file we can check it for correctness.

Here's the output from that command. They appear to be the same errors as shown in the book, but a lot more verbose.
(BTW, I've had to leave off the last few lines of the 3rd error as including them appears to blow up the forum software. Those lines are identical to those appearing in the other errors, however.)

Code:

C:\Data\Work\nodeJS\apps\nockmarket>.\node_modules\.bin\mocha -u tdd
...
? 3 of 3 tests failed:
1) exchange buy should add a BUY nockmarket order:
ReferenceError: exchange is not defined
at Context.<anonymous> (C:\Data\Work\nodeJS\apps\nockmarket\test\exchange.test.js:10:20)
at Test.Runnable.run (C:\Data\Work\nodeJS\apps\nockmarket\node_modules\mocha\lib\runnable.js:171:15)
at Runner.runTest (C:\Data\Work\nodeJS\apps\nockmarket\node_modules\mocha\lib\runner.js:300:10)
at Runner.runTests.next (C:\Data\Work\nodeJS\apps\nockmarket\node_modules\mocha\lib\runner.js:346:12)
at next (C:\Data\Work\nodeJS\apps\nockmarket\node_modules\mocha\lib\runner.js:228:14)
at Runner.hooks (C:\Data\Work\nodeJS\apps\nockmarket\node_modules\mocha\lib\runner.js:237:7)
at next (C:\Data\Work\nodeJS\apps\nockmarket\node_modules\mocha\lib\runner.js:185:23)
at Runner.hook (C:\Data\Work\nodeJS\apps\nockmarket\node_modules\mocha\lib\runner.js:205:5)
at process.startup.processNextTick.process._tickCallback (node.js:244:9)
2) exchange sell should add a SELL nockmarket order:
ReferenceError: exchange is not defined
at Context.<anonymous> (C:\Data\Work\nodeJS\apps\nockmarket\test\exchange.test.js:16:20)
at Test.Runnable.run (C:\Data\Work\nodeJS\apps\nockmarket\node_modules\mocha\lib\runnable.js:171:15)
at Runner.runTest (C:\Data\Work\nodeJS\apps\nockmarket\node_modules\mocha\lib\runner.js:300:10)
at Runner.runTests.next (C:\Data\Work\nodeJS\apps\nockmarket\node_modules\mocha\lib\runner.js:346:12)
at next (C:\Data\Work\nodeJS\apps\nockmarket\node_modules\mocha\lib\runner.js:228:14)
at Runner.hooks (C:\Data\Work\nodeJS\apps\nockmarket\node_modules\mocha\lib\runner.js:237:7)
at next (C:\Data\Work\nodeJS\apps\nockmarket\node_modules\mocha\lib\runner.js:185:23)
at Runner.hook (C:\Data\Work\nodeJS\apps\nockmarket\node_modules\mocha\lib\runner.js:205:5)
at process.startup.processNextTick.process._tickCallback (node.js:244:9)
3) exchange sell should produce trades:
ReferenceError: exchange is not defined
at Context.<anonymous> (C:\Data\Work\nodeJS\apps\nockmarket\test\exchange.test.js:22:20)
at Test.Runnable.run (C:\Data\Work\nodeJS\apps\nockmarket\node_modules\mocha\lib\runnable.js:171:15)
at Runner.runTest (C:\Data\Work\nodeJS\apps\nockmarket\node_modules\mocha\lib\runner.js:300:10)
at Runner.runTests.next (C:\Data\Work\nodeJS\apps\nockmarket\node_modules\mocha\lib\runner.js:346:12)
...
...

I haven't got that far. As of page 24, we haven't created that folder. The tests have been written but not the code that they are testing.

Ah well, in that case we're on the right track. If your tests are failing, then you're ready to move on to the next steps (which is writing the code that they test).

As Don mentioned, Cygwin can be a little troublesome, but if you install the Mocha module globally (npm install mocha -g) you should be able to run the tests in regular Windows command prompt by using mocha -u tdd

P.S. Thanks for that tip @Don Nguyen ;, I hadn't actually used Mocha before, this is a good chance to get familiar with it

THead, although slightly counterintuitive the failure that you have posted is OK. From the snippet that you have posted it looks like Mocha is working which is the important thing. If the tests are still failing at the end of the chapter THEN we have a problem :-)

@AussieJohn one of many good frameworks available. Hope you are enjoying the book let me know if you have any questions.