Skip to content

Instantly share code, notes, and snippets.

@tsmx
Created August 9, 2020 19:05
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tsmx/feb3748be5ba62a0164d575adb4b9368 to your computer and use it in GitHub Desktop.
Save tsmx/feb3748be5ba62a0164d575adb4b9368 to your computer and use it in GitHub Desktop.
Jest: set environment variable for all tests via configuration file
// MY_VAR is available in all Jest tests and suites, no need to adapt the before() or beforeAll() functions
process.env['MY_VAR'] = 'My-Var-value';
module.exports = {
testEnvironment: 'node'
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment