Let's say I have a structure like so:
/Users/me/Desktop...
app/
node_modules/
subdir/
test/
mytest.coffee
If I cd /Users/me/Desktop/app/subdir, then run mocha tests like this:
/Users/me/Desktop/app/node_modules/mocha/bin/mocha --compilers coffee:coffee-script --require ../node_modules/coffee-script ./test --reporter spec --require should -t 5000 --colors -b
This works.
But when I change ../node_modules/coffee-script to /Users/me/Desktop/app/node_modules/coffee-script, I receive an error with a duplicate pathname:
Cannot find module /Users/me/Desktop/app/Users/me/Desktop/app/node_modules/coffee-script
Why is this? The use-case is that I'm trying to not pollute the global namespace from an NPM package, so it uses its install path + node_modules path for deps.
You can simply do --require coffee-script? Node will resolve the path to the nearest node_modules folder.