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

[Docs] Please document what ENV variables are set by Jest #8856

Closed
Akuukis opened this issue Aug 20, 2019 · 8 comments · Fixed by #10630
Closed

[Docs] Please document what ENV variables are set by Jest #8856

Akuukis opened this issue Aug 20, 2019 · 8 comments · Fixed by #10630

Comments

@Akuukis
Copy link

Akuukis commented Aug 20, 2019

🚀 Feature Proposal

Please document what ENV variables are set by Jest, and whenever users are supposed to use them or not.

Motivation

I'm trying to detect whenever runtime is within Jest environment or not.

Example

Jest sets the following ENV variables:

  • JEST_WORKER_ID [number] Id of the Jest worker. Use it for ...
  • ...
@SimenB
Copy link
Member

SimenB commented Aug 20, 2019

You can use NODE_ENV - Jest sets it to test unless it's already set to something else

@Akuukis
Copy link
Author

Akuukis commented Aug 20, 2019

Oh, after you said that I explicitly searched docs for it and yes, indeed, under "Getting Started" > "Using Babel" > "Making your Babel config jest-aware" that's mentioned. Thank you, my current problem is solved!

I will leave this ticket open, because I do use also JEST_WORKER_ID and I believe it should appear in docs to understand whenever and how I should use it, as well I'm not aware of other global variables.

@jeysal
Copy link
Contributor

jeysal commented Aug 20, 2019 via email

@Akuukis
Copy link
Author

Akuukis commented Aug 20, 2019

JEST_WORKER_ID doesn't show up in doc search, but suggests --maxWorkers instead.

2019-08-20-114300_3840x1080_scrot

@jeysal
Copy link
Contributor

jeysal commented Aug 20, 2019

Found it :D https://jestjs.io/docs/en/dynamodb
But yeah that's not a good location, there should be a central list of env variables or something ^^

@mojoaxel
Copy link

mojoaxel commented Oct 7, 2019

You can use NODE_ENV - Jest sets it to test unless it's already set to something else

@SimenB This is no longer the case since the update to babel@7 😞

@stdavis
Copy link
Contributor

stdavis commented Oct 13, 2020

I'd love to help out with this. @jeysal: do you have a thought as to where in the docs the list of environment variables should be? I was thinking maybe a new page under the "API Reference" section? Or just add it to Getting Started, although it doesn't seem like a getting-started thing? Maybe add a section to Globals?

@github-actions
Copy link

This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.
Please note this issue tracker is not a help forum. We recommend using StackOverflow or our discord channel for questions.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators May 11, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants