Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Cannot resolve path in Mocha

I am currently using Nitrous, which shouldn't matter, but I needed to install mocha so I typed in:

npm install - g mocha. 

Everything installed and when I try to run mocha in my command line I get the following error:

/home/action/.parts/lib/node_modules/mocha/bin/_mocha:454
if (!files.length) throw new Error("cannot resolve path (or pattern) '"

Error: cannot resolve path (or pattern) 'test/unit'
at lookupFiles (/home/action/.parts/lib/node_modules/mocha/bin/_mocha:454:32)
at runAgain (/home/action/.parts/lib/node_modules/mocha/bin/_mocha:305:24)
at Array.forEach (native)
at Object. (/home/action/.parts/lib/node_modules/mocha/bin/_mocha:304:6)
at Module._compile (module.js:456:26)
at Object.Module._extensions..js (module.js:474:10)
at Module.load (module.js:356:32)
at Function.Module._load (module.js:312:12)
at Function.Module.runMain (module.js:497:10)
at startup (node.js:119:16)
at node.js:902:3

Does anyone know how to solve this?

like image 345
purewisdom1 Avatar asked Oct 03 '14 15:10

purewisdom1


1 Answers

By default, mocha includes ./test/*.js. So if that is where your tests live, just running mocha is all you need.

If you have your tests in test/unit, you might want to run mocha ./test/unit/*.js.

like image 87
mantoni Avatar answered Sep 17 '22 20:09

mantoni