mocha
mocha copied to clipboard
🚀 Feature: Support setting options via environment vars
As discussed in #4232, it can be difficult to pass mocha command-line options through npm run
scripts. As @boneskull said:
yargs has a feature that supports setting options via an environment variable; we should probably take advantage of that at some point. Might even be an issue for it already.
I didn't see any open issues for this so figured I would open one.
sorry, butt-closed this one
yargs has support for this via .env()
which we should be able to leverage.
From reading the yargs
docs seems like .env('MOCHA')
should be sufficient, I'll open a PR soon
in my experience, it's never that easy, but I wish you luck regardless 😅
You know, this just makes me wish yargs itself would accept an environment variable that's equivalent to .env('MOCHA')
so I could do this kind of thing with any command built with yargs
https://github.com/mochajs/mocha/pull/4835