-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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 request: set NODE_ENV=test #1470
Comments
Can you check if any other test runner like Mocha, Jest, QUnit, etc, sets this? Any prior art? |
The prior art I can find is:
"Actively" not set for: Could not find for:
Not a testing framework but a framework for building front end web apps:
So it's mixed. I'm going to close this for now but happy to have a discussion and consider this proposal if you'd like to take it forwards. |
We can keep it open to see what the rest of the team and anyone else thinks. |
We're using |
On the one hand, I've only run into a situation where I needed I'm less interested in using it to control how I'm leaning towards 👍 on this, but I wonder if the default value ( @sindresorhus what's your preference on this? |
Neh, not until someone asks for it and provides a good use-case I would say.
I'm 👍 as long as we have a warning in the docs about its dangers. You should not use it extensively in your code, as you're then no longer testing the actual code paths, but rather the ones made for the tests. |
Cool, let's do this 👍 |
This is very heart-breaking. NODE_ENV is such a crucial piece that ava taking such a bold decision is simply unfathomable. There are so many use cases that change their behavior based on NODE_ENV and even on its absence, they all now break. I think the worst part is we can't force ava to not set it, deliberately leaving NODE_ENV empty. This breaks log-suppress, and probably many others. |
Hey @dashersw sorry to hear you've obviously encountered hassle with this change. We did look at prior art to see what others were doing and why. From looking at the implementation of #1523 it would be possible to set |
@AJamesPhillips how do you mean, before ava? The implementation uses But apart from these, why the need for such a feature? Apparently ava itself doesn't make use of this feature. Why was this approach with many implications chosen over simply typing |
Run
Running:
So that should be fine. Shout if you have any problems with that @dashersw |
That unfortunately sets |
Got it. You can use this:
Does that let log-suppress work? Alternatively submit a fix for log-suppress. Actually the docs also show:
So it seems you should use: |
With |
Description
To set
process.env.NODE_ENV='test'
if it is not already set.The text was updated successfully, but these errors were encountered: