A platform combines multiple tutorials, projects, documentations, questions and answers for developers
  • Home (current)
  • Documentations
  • About
  • Login
  1. Home
  2. Documentations
  3. Jest
  4. Environment Variables

Environment Variables

Jest sets the following environment variables:

NODE_ENV

Set to 'test' if it's not already set to something else.

JEST_WORKER_ID

Each worker process is assigned a unique id (index-based that starts with 1). This is set to 1 for all tests when runInBand is set to true.

© 2021 Facebook, Inc.
Licensed under the MIT License.
https://jestjs.io/docs/environment-variables

Guides
An Async Example
Architecture
Bypassing module mocks
DOM Manipulation
ECMAScript Modules
ES6 Class Mocks
Manual Mocks
Migrating to Jest
Snapshot Testing
Timer Mocks
Troubleshooting
Using with DynamoDB
Using with MongoDB
Using with puppeteer
Using with webpack
Watch Plugins
Guides: Introduction
Jest Community
Jest Platform
Mock Functions
More Resources
Setup and Teardown
Testing Asynchronous Code
Using Matchers
Framework Guides
Testing React Apps
Testing React Native Apps
Testing Web Frameworks
Mock Functions
Mock Functions
jest.MockedClass
jest.MockedFunction
mockFn.getMockName()
mockFn.mock.calls
mockFn.mock.instances
mockFn.mock.results
mockFn.mockClear()
mockFn.mockImplementation()
mockFn.mockImplementationOnce()
mockFn.mockName()
mockFn.mockRejectedValue()
mockFn.mockRejectedValueOnce()
mockFn.mockReset()
mockFn.mockResolvedValue()
mockFn.mockResolvedValueOnce()
mockFn.mockRestore()
mockFn.mockReturnThis()
mockFn.mockReturnValue()
mockFn.mockReturnValueOnce()
Expect
.not
.rejects
.resolves
.toBe()
.toBeCloseTo()
.toBeDefined()
.toBeFalsy()
.toBeGreaterThan()
.toBeGreaterThanOrEqual()
.toBeInstanceOf()
.toBeLessThan()
.toBeLessThanOrEqual()
.toBeNaN()
.toBeNull()
.toBeTruthy()
.toBeUndefined()
.toContain()
.toContainEqual()
.toEqual()
.toHaveBeenCalled()
.toHaveBeenCalledTimes()
.toHaveBeenCalledWith()
.toHaveBeenLastCalledWith()
.toHaveBeenNthCalledWith()
.toHaveLastReturnedWith()
.toHaveLength()
.toHaveNthReturnedWith()
.toHaveProperty()
.toHaveReturned()
.toHaveReturnedTimes()
.toHaveReturnedWith()
.toMatch()
.toMatchInlineSnapshot()
.toMatchObject()
.toMatchSnapshot()
.toStrictEqual()
.toThrow()
.toThrowErrorMatchingInlineSnapshot()
.toThrowErrorMatchingSnapshot()
Expect
Globals
Globals
afterAll()
afterEach()
beforeAll()
beforeEach()
describe()
describe.each()
describe.only()
describe.only.each()
describe.skip()
describe.skip.each()
expect()
expect.addSnapshotSerializer()
expect.any()
expect.anything()
expect.arrayContaining()
expect.assertions()
expect.extend()
expect.hasAssertions()
expect.not.arrayContaining()
expect.not.objectContaining()
expect.not.stringContaining()
expect.not.stringMatching()
expect.objectContaining()
expect.stringContaining()
expect.stringMatching()
test()
test.concurrent()
test.concurrent.each()
test.concurrent.only.each()
test.concurrent.skip.each()
test.each()
test.only()
test.only.each()
test.skip()
test.skip.each()
test.todo()
Code Transformation
Code Transformation
Configuring Jest
Config: //
Config: automock
Config: bail
Config: cacheDirectory
Config: clearMocks
Config: collectCoverage
Config: collectCoverageFrom
Config: coverageDirectory
Config: coveragePathIgnorePatterns
Config: coverageProvider
Config: coverageReporters
Config: coverageThreshold
Config: dependencyExtractor
Config: displayName
Config: errorOnDeprecated
Config: extensionsToTreatAsEsm
Config: extraGlobals
Config: forceCoverageMatch
Config: globalSetup
Config: globalTeardown
Config: globals
Config: haste
Config: injectGlobals
Config: maxConcurrency
Config: maxWorkers
Config: moduleDirectories
Config: moduleFileExtensions
Config: moduleNameMapper
Config: modulePathIgnorePatterns
Config: modulePaths
Config: notify
Config: notifyMode
Config: preset
Config: prettierPath
Config: projects
Config: reporters
Config: resetMocks
Config: resetModules
Config: resolver
Config: restoreMocks
Config: rootDir
Config: roots
Config: runner
Config: setupFiles
Config: setupFilesAfterEnv
Config: slowTestThreshold
Config: snapshotResolver
Config: snapshotSerializers
Config: testEnvironment
Config: testEnvironmentOptions
Config: testFailureExitCode
Config: testMatch
Config: testPathIgnorePatterns
Config: testRegex
Config: testResultsProcessor
Config: testRunner
Config: testSequencer
Config: testTimeout
Config: testURL
Config: timers
Config: transform
Config: transformIgnorePatterns
Config: unmockedModulePathPatterns
Config: verbose
Config: watchPathIgnorePatterns
Config: watchPlugins
Config: watchman
Configuring Jest
Environment Variables
Environment Variables
Jest CLI Options
Jest CLI Options
jest
jest --bail
jest --cache
jest --changedFilesWithAncestor
jest --changedSince
jest --ci
jest --clearCache
jest --collectCoverageFrom
jest --colors
jest --config
jest --coverageProvider
jest --coverage[
jest --debug
jest --detectOpenHandles
jest --env
jest --errorOnDeprecated
jest --expand
jest --filter
jest --findRelatedTests
jest --forceExit
jest --help
jest --init
jest --injectGlobals
jest --json
jest --lastCommit
jest --listTests
jest --logHeapUsage
jest --maxConcurrency
jest --maxWorkers
jest --noStackTrace
jest --notify
jest --onlyChanged
jest --outputFile
jest --passWithNoTests
jest --projects
jest --reporters
jest --roots
jest --runInBand
jest --runTestsByPath
jest --selectProjects
jest --setupTestFrameworkScriptFile
jest --showConfig
jest --silent
jest --testLocationInResults
jest --testNamePattern
jest --testPathIgnorePatterns
jest --testPathPattern
jest --testRunner
jest --testSequencer
jest --testTimeout
jest --updateSnapshot
jest --useStderr
jest --verbose
jest --version
jest --watch
jest --watchAll
jest --watchman
The Jest Object
The Jest Object
jest.advanceTimersByTime()
jest.advanceTimersToNextTimer()
jest.clearAllMocks()
jest.clearAllTimers()
jest.createMockFromModule()
jest.disableAutomock()
jest.doMock()
jest.dontMock()
jest.enableAutomock()
jest.fn()
jest.getRealSystemTime()
jest.getTimerCount()
jest.isMockFunction()
jest.isolateModules()
jest.mock()
jest.requireActual()
jest.requireMock()
jest.resetAllMocks()
jest.resetModules()
jest.restoreAllMocks()
jest.retryTimes()
jest.runAllImmediates()
jest.runAllTicks()
jest.runAllTimers()
jest.runOnlyPendingTimers()
jest.setMock()
jest.setSystemTime()
jest.setTimeout()
jest.spyOn()
jest.spyOn()
jest.unmock()
jest.useFakeTimers()
jest.useRealTimers()
Copyright ©2026 TypeError Powered By AnyPost, page cost 18ms.
Privacy Policy