I am writing test cases for my Node.js application using Mocha. The test cases need an API key as an extra input option or parameter. The API key is private, so I don\'t wan
I don't think Mocha itself supports passing extra parameters to your tests, but you could use environment variables:
env KEY=YOUR_KEY mocha test/*.js # assumes some sort of Unix-type OS.
And read them in your test files:
var key = process.env.KEY;