Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

🚀 Feature: Support setting options via environment vars #4330

Closed
jedwards1211 opened this issue Jun 10, 2020 · 6 comments · Fixed by #4835
Closed

🚀 Feature: Support setting options via environment vars #4330

jedwards1211 opened this issue Jun 10, 2020 · 6 comments · Fixed by #4835
Labels
area: node.js command-line-or-Node.js-specific semver-minor implementation requires increase of "minor" version number; "features" status: accepting prs Mocha can use your help with this one! type: feature enhancement proposal

Comments

@jedwards1211
Copy link

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.

@jedwards1211 jedwards1211 added the type: feature enhancement proposal label Jun 10, 2020
@boneskull boneskull added status: accepting prs Mocha can use your help with this one! area: node.js command-line-or-Node.js-specific labels Jun 10, 2020
@boneskull boneskull reopened this Jun 10, 2020
@boneskull
Copy link
Contributor

sorry, butt-closed this one

yargs has support for this via .env() which we should be able to leverage.

@jedwards1211
Copy link
Author

From reading the yargs docs seems like .env('MOCHA') should be sufficient, I'll open a PR soon

@boneskull
Copy link
Contributor

in my experience, it's never that easy, but I wish you luck regardless 😅

@jedwards1211
Copy link
Author

jedwards1211 commented Jun 10, 2020

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

@JoshuaKGoldberg JoshuaKGoldberg changed the title Support setting options via environment vars 🚀 Feature: Support setting options via environment vars Dec 27, 2023
@icholy
Copy link
Contributor

icholy commented Dec 27, 2023

#4835

@JoshuaKGoldberg JoshuaKGoldberg added the semver-minor implementation requires increase of "minor" version number; "features" label Mar 4, 2024
@JoshuaKGoldberg
Copy link
Member

#4835 was released in [email protected]. 🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: node.js command-line-or-Node.js-specific semver-minor implementation requires increase of "minor" version number; "features" status: accepting prs Mocha can use your help with this one! type: feature enhancement proposal
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants