-
Notifications
You must be signed in to change notification settings - Fork 609
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
[heft] NODE_ENV env variable not set during test phase #2420
Comments
Thanks for reporting this. I'll be back from vacation next week and can take a look. Supporting the environment variable is relatively easy (and maybe could be done as a first PR to get you unblocked). But we should work out the "right way" to pass down environment settings when using Heft. Seems like Webpack variables and Jest variables should be combined into a single global API. |
Let's use this issue to track the "easy" fix of exposing @Lebowskovitch are you able to make a PR? Heft's Jest config is set up here. |
Since heft-jest-plugin is using the One way is to add the new optional field
If you agree with this I'll make a PR and add it, this would save me a lot of work of setting up the NODE_ENV for over 40 pacakges |
set NODE_ENV to test if not already set to something and new test fixes microsoft#2420
set NODE_ENV to test if not already set to something and new test fixes microsoft#2420
Summary
So, the issue is pretty simple: Jest, as specified in its documentation should set 2 environment variables during its execution:
JEST_WORKER_ID
andNODE_ENV
(to valuetest
).Using
heft test
command which then calls Jest, it appears theNODE_ENV
variable is not set, onlyJEST_WORKER_ID
.This breaks any test specific logic which uses this env variable.
As discussed with @octogonz:
The text was updated successfully, but these errors were encountered: