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

Created on 20 Aug 2019  Â·  7Comments  Â·  Source: facebook/jest

🚀 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 ...
  • ...
Documentation Help Wanted good first issue

All 7 comments

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

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.

Pretty sure that's also documented somewhere, but I agree an overview
somewhere might make sense.

On Tue, 20 Aug 2019, 10:32 Akuukis, notifications@github.com wrote:

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.

—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
https://github.com/facebook/jest/issues/8856?email_source=notifications&email_token=AD2TI5573AFMDP4KERLGLQLQFOTYVA5CNFSM4INRPI62YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOD4VQI3Q#issuecomment-522912878,
or mute the thread
https://github.com/notifications/unsubscribe-auth/AD2TI53T7S34NBMMCA2X5S3QFOTYVANCNFSM4INRPI6Q
.

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

2019-08-20-114300_3840x1080_scrot

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 ^^

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 :disappointed:

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?

Was this page helpful?
0 / 5 - 0 ratings

Related issues

jardakotesovec picture jardakotesovec  Â·  3Comments

nsand picture nsand  Â·  3Comments

ticky picture ticky  Â·  3Comments

withinboredom picture withinboredom  Â·  3Comments

stephenlautier picture stephenlautier  Â·  3Comments