After a bit more digging I finally got the answers.
Nodemon will pass on all arguments as is:
nodemon app.js --env=dev
Mocha will do the same, however you must specify a filename after spec or else it tries to interpret the command line args itself. So even though mocha defaults to test/test.js
, specifying this allows command line args to pass to the app:
istanbul cover node_modules/mocha/bin/_mocha -- -R spec test/test.js --env=test