npm
npmjs.com › package › jest-environment-node
jest-environment-node - npm
1 week ago - Latest version: 30.4.1, last published: 7 days ago. Start using jest-environment-node in your project by running `npm i jest-environment-node`. There are 1184 other projects in the npm registry using jest-environment-node.
» npm install jest-environment-node
Published May 08, 2026
Version 30.4.1
Videos
09:41
Introduction to Testing with Jest in Node.js | JavaScript & ...
09:11
Setting Up Node.js Project with TypeScript and Jest: Step-by-Step ...
25:40
Guide to Testing Node.js Applications with Jest and TypeScript ...
10:56
Jest tutorial with Node | testing Node.js applications - YouTube
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
Published Jan 29, 2024
Version 29.4.0
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
Jest
jestjs.io › environment variables
Environment Variables · Jest
1 week ago - 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 ·
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
Jest
jestjs.io › getting started
Getting Started · Jest
1 week ago - Jest will set process.env.NODE_ENV to 'test' if it's not set to something else.
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
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
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 });
Top answer 1 of 4
30
Jest automatically defines environment variable NODE_ENV as test(see https://jestjs.io/docs/environment-variables), as you can confirm from your error message:
console.error node_modules/config/lib/config.js:1727
WARNING: NODE_ENV value of 'test' did not match any deployment config file names.
What you can do is simply create config/test.json and include the contents {}, which is an empty valid JSON object.
See https://github.com/lorenwest/node-config/wiki/Strict-Mode
Note: the aforementioned error occurs when you use the config package, and meanwhile you don't have the test.json file in the config directory.
2 of 4
5
The easiest way is using cross-env package:
npm install --save-dev cross-env
Then, you can use it in your package.json:
"scripts": {
"test": "cross-env NODE_ENV=development jest --config jest.config.json"
}
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: