🌐
npm
npmjs.com › package › jest-environment-node
jest-environment-node - npm
March 10, 2026 - Latest version: 30.3.0, last published: a month ago. Start using jest-environment-node in your project by running `npm i jest-environment-node`. There are 1181 other projects in the npm registry using jest-environment-node.
      » npm install jest-environment-node
    
Published   Mar 10, 2026
Version   30.3.0
🌐
Jest
jestjs.io › configuring jest
Configuring Jest · Jest
The test environment that will be used for testing. The default environment in Jest is a Node.js environment.
🌐
npm
npmjs.com › package › jest-environment-node-single-context
jest-environment-node-single-context - npm
January 29, 2024 - Jest environment for Node with single context. Latest version: 29.4.0, last published: 2 years ago. Start using jest-environment-node-single-context in your project by running `npm i jest-environment-node-single-context`. There are 2 other projects in the npm registry using jest-environment-node-single-context.
      » npm install jest-environment-node-single-context
    
🌐
Jest
jestjs.io › environment variables
Environment Variables · Jest
June 10, 2025 - Jest sets the following environment variables: Set to 'test' if it's not already set to something else. 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. NODE_ENV ·
🌐
Jest
jestjs.io › getting started
Getting Started · Jest
Jest will set process.env.NODE_ENV to 'test' if it's not set to something else.
🌐
GitHub
github.com › kayahr › jest-environment-node-single-context
GitHub - kayahr/jest-environment-node-single-context: Jest environment for Node with single context · GitHub
See Jest issue #2549 for details. This small project provides a single-context Node.js environment which effectively sacrifices the context isolation feature by using a single context for all tests so instanceof checks works again as expected.
Starred by 25 users
Forked by 2 users
Languages   TypeScript
🌐
jsDocs.io
jsdocs.io › package › jest-environment-node
jest-environment-node@30.2.0 - jsDocs.io
Documentation for npm package jest-environment-node@30.2.0 - jsDocs.io
🌐
Ken Muse
kenmuse.com › blog › crash-course-jest-test-environments-with-typescript
A Crash Course on Jest TestEnvironments with TypeScript - Ken Muse
August 24, 2024 - Essentially, it’s a module that can be used to setup the test environment that is used for executing the tests. Out of the box, it defaults to node, but offers jsdom for web testing.
🌐
Testing JavaScript
testingjavascript.com › lessons › jest-configure-jest-s-test-environment-for-testing-node-or-browser-code
Configure Jest’s Test Environment for Testing Node or Browser Code
In our application we’re testing code that should run in the browser, but Jest is intended to test JavaScript that runs in the browser or in node. Let’s create a custom jest config file so we can customize the test environment.
Find elsewhere
🌐
GitHub
github.com › jestjs › jest › blob › main › packages › jest-environment-node › src › index.ts
jest/packages/jest-environment-node/src/index.ts at main · jestjs/jest
customExportConditions = ['node', 'node-addons']; private readonly _configuredExportConditions?: Array<string>; private _globalProxy: GlobalProxy; · // while `context` is unused, it should always be passed · constructor(config: JestEnvironmentConfig, _context: EnvironmentContext) { const {projectConfig} = config; ·
Author   jestjs
🌐
Medium
medium.com › @yiqun.rong2 › jest-test-lifecycle-and-test-environment-06cfbf90f612
Jest test lifecycle and test environment | by Rong | Medium
December 3, 2023 - In Jest, the “Test Environment” specifies the environment in which your tests are executed. It defines the global variables that are available and how certain operations, such as timers and DOM manipulation, are handled.
🌐
Stack Overflow
stackoverflow.com › questions › 73865763 › use-jest-environment-jsdom-and-jest-environment-node-both-in-the-same-project
Use @jest-environment jsdom and @jest-environment node both in the same project [Jest-ReactJS]
/** @type {import('ts-jest/dist/types').InitialOptionsTsJest} */ module.exports = { preset: 'ts-jest', testEnvironment: 'node' }; I have tried below approach, but it didn't work in my experience. /** * @jest-environment jsdom */ test('use jsdom in this test file', () => { const element = document.createElement('div'); expect(element).not.toBeNull(); }); /** * @jest-environment node */ test('do not use jsdom in this test file', () => { console.log(window); // this will fail as node doesn't have a window object });
🌐
DEV Community
dev.to › chukwutosin_ › using-environment-variables-when-testing-with-jest-in-nodejs-124d
How to use environment variables when testing with Jest in NodeJs - DEV Community
March 11, 2021 - I'm using dotenv for the environment variables and jest for testing and all you need to do is add the dotenv config to the jest setup files in your package.json file.
🌐
GitHub
github.com › capricorn86 › happy-dom › wiki › Jest-Environment
Jest Environment · capricorn86/happy-dom Wiki
September 28, 2025 - npm install --save-dev @jest/environment @jest/fake-timers @jest/types @jest/mock @jest/util @happy-dom/jest-environment · Jest uses node as test environment by default.
Author   capricorn86
🌐
BrowserStack
browserstack.com › home › guide › how to configure jest
How to Configure Jest | BrowserStack
August 4, 2025 - In this section, discuss a few important environmental variables:- NODE_ENV:- Jest, by default, sets ‘node_env’ to ‘test’. This variable communicates to the application what environment it is running in.
🌐
Npm
npm.io › package › jest-environment-node
Jest-environment-node NPM | npm.io
Based on your project, Jest will ask you a few questions and will create a basic configuration file with a short description for each option: ... If you do not already have babel configured for your project, you can use Babel to target your current version of Node by creating a babel.config.js file in the root of your project: