This needs to be on the internet, because I didn't find it in a search.
I try to run mocha via npm and pass it `-grep` or `-fgrep` and I get this awful error (can you tell how annoyed I am) about "Cannot find module '-e'" and I think something is wrong with npm install BUT NO
What that should say is
$ npm run mocha -- -fgrep "annotation with string content found"
> @atomist/spring-team-handlers@0.5.10 mocha /Users/jessitron/code/atomisthq/spring-team-handlers/.atomist
> mocha --require intelli-espower-loader 'target/ts-built/mocha/**/*.js' "-fgrep" "annotation with string content found"
Error: Cannot find module '-e'
at Function.Module._resolveFilename (module.js:485:15)
at Function.Module._load (module.js:437:25)
at Module.require (module.js:513:17)
"Invalid option -fgrep. Try --fgrep"
So when future me finds this by searching the internet next time: Jess, use two dashes before the `grep` or `fgrep` options to mocha.
Bad error messages are one of the single largest productivity drains of developers.
ReplyDeleteIt seems in this case the root cause was poor command-line parsing.