-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
Support for Node.js Built-in .env
File
#2346
Comments
Thanks for raising @x80486, I hadn't heard about the built-in However, to have an NODE_OPTIONS="--env-file=.env" npx cucumber-js (I think this could be unergonomic in practise for users, because Cucumber only allows its own configuration to be set in files or the CLI. If we were to add support for configuration via environment variables, you could control everything - Cucumber stuff and non-Cucumber stuff - via a |
I agree with the perspective that we should aim to reuse existing tools and mechanisms when possible to keep things simple and avoid redundancy. The primary goal should be to enhance Cucumber's compatibility with Node.js without adding unnecessary complexity. Additional dependencies is also a valid concern. For instance, if users had to rely on external dependencies or complex configurations to use Another suggestion that comes to my minf is to have a CLI configuration setting: |
Yep exactly. I think we'll wait a bit and see where Node.js goes with the dotenv file support. It may be that, much like module loaders, future releases make it less friction-y to use and add the ability to activate it in-process, at which point it might start to make sense for Cucumber to lean into it. |
"test": "export $(cat .env | xargs) && npx cucumber-js" Not a beautiful solution, but it works... |
🤔 What's the problem you're trying to solve?
Currently, Cucumber.js primarily relies on environment variables set externally for configuration. With Node.js introducing support for the
.env
file format, it would be beneficial to allow Cucumber.js to read environment variables from the.env
file as an additional or alternative source of configuration.Why This Is Important:
Consistency with Node.js Ecosystem: Given that Node.js supports
.env
files, adding support for them in Cucumber.js would align with best practices and the Node.js ecosystem's standards.Enhanced Integration: Cucumber.js could offer seamless integration with Node.js projects by providing built-in support for
.env
files, fostering a more cohesive testing experience.✨ What's your proposed solution?
Since this is usually used when developing locally, I think a configuration key might be useful to enable this at the profile level, but there is also simplicity on just enabling this globally or not, in the same way Node.js currently does.
⛏ Have you considered any alternatives or workarounds?
I'm currently using some of the libraries that provide similar behavior.
📚 Any additional context?
N/A
The text was updated successfully, but these errors were encountered: