How to run Mocha tests on windows node.js ( Error: Cannot find module 'C:\cygdrive\c\Users )

I'm trying to run an app in windows and this app has some mocha tests. I need make. I read this

Mocha requires make. Can't find a make.exe that works on Windows

and this

Node.js cannot find module - interfering with cygwin on Windows

I have the app in the Github directory (outside of cygwin directory structure ) and i installed the windows version of node.

I Tried using powershell and setting the alias as suggested but i always get

> module.js:340
>     throw err;
>           ^ Error: Cannot find module 'C:\cygdrive\c\Users\Nicola\AppData\Roaming\npm\node_modules\mocha\bin\mocha'
>     at Function.Module._resolveFilename (module.js:338:15)
>     at Function.Module._load (module.js:280:25)
>     at Module.runMain (module.js:487:10)
>     at process.startup.processNextTick.process._tickCallback (node.js:244:9) Makefile:5: recipe for target `test' failed make: ***
> [test] Error 1

and i have mocha installed in that directory ( BTW why doesn't he look for mocha in the node_modules subdir? ). The problems seems to be the C:\cygdrive\c\Users part how do i take that off?

I also tried copying the file to my home/ directory under cygwin but i got

./node_modules/.bin/mocha: line 1: ../mocha/bin/mocha: No such file or directory
Makefile:5: recipe for target `test' failed
make: *** [test] Error 127

what should i do?

You should use msysgit - it comes with make.

Best way I've been able to do it is to first install mocha in the directory (i.e: npm install mocha). Then in the npm test command inside package.json, use 'test': 'node ./node_modules/mocha/bin/mocha". This way, you can easily run npm test in CLI for standardization. You can now either setup your tests in a test/ directory or have a simple test.js file in case you only have a few tests to run. Also, don't forget to have a mocha.opts file with your options. This should work, especially if you're using Git Bash (I tried on windows CMD and it works too!).

when you write "make test" and you receive this:

./node_modules/.bin/mocha: line 1: ../mocha/bin/mocha: No such file or directory
Makefile:5: recipe for target `test' failed
make: *** [test] Error 127

it means that you don't have Mocha installed in your project. Put mocha in your package.json and run 'npm install':

{
"name": "appName"
, "version": "0.0.1"
, "private": true
, "dependencies": {

  "mocha": "1.3.0"
, "should": "1.0.0"

}
}

after that i got my tests running on windows.