🌐
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
🌐
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 ·
🌐
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.
🌐
Stack Overflow
stackoverflow.com › questions › 68627205 › use-jest-inside-jest-test-environment
Use jest inside Jest Test Environment - javascript
I have created a Jest test environment in which I mock a specific module: const NodeEnvironment = require('jest-environment-node'); const { lumigo } = require('../../src/services/lumigo'); class
🌐
npm
npmjs.com › package › @jest › environment
@jest/environment - npm
September 1, 2025 - Latest version: 30.2.0, last published: 2 months ago. Start using @jest/environment in your project by running `npm i @jest/environment`. There are 72 other projects in the npm registry using @jest/environment.
      » npm install @jest/environment
    
Published   Sep 28, 2025
Version   30.2.0
🌐
Jest
jestjs.io › configuring jest
Configuring Jest · Jest
1 week ago - Use the <rootDir> string token to include the path to your project's root directory to prevent it from accidentally ignoring all of your files in different environments that may have different root directories. ... An alternative API to setting the NODE_PATH env variable, modulePaths is an array of absolute paths to additional locations to search when resolving modules. Use the <rootDir> string token to include the path to your project's root directory. ... Activates native OS notifications for test results. To display the notifications Jest needs node-notifier package, which must be installed additionally:
🌐
Jest
jestjs.io › test environment
Test Environment · Jest
1 week ago - To have more fine-grained control, you can use docblock pragmas to specify environment for specific files. Docblock pragmas are comments that start with @jest-environment and are followed by the environment name: ... Jest allows you to extend the built-in environments, such as NodeEnvironment or JSDOMEnvironment, to create your own custom environment.
🌐
Edge Runtime
edge-runtime.vercel.app › packages › jest-environment
Edge Runtime Jest Environment | Edge Runtime
Jest enables you to define the test environment through a code comment (opens in a new tab) or as a CLI option (opens in a new tab). ... // jest --env node // ✅ Pass it('should return the correct value', () => { let val = eval('2 + 2') ...
Find elsewhere
🌐
Medium
medium.com › @yiqun.rong2 › jest-test-lifecycle-and-test-environment-06cfbf90f612
Jest test lifecycle and test environment | by Rong | Medium
December 3, 2023 - It does not mock a DOM and is best suited for testing code that runs in a Node.js context, like server-side scripts, APIs, or command-line tools. We can also create custom test environments in Jest. This is useful if you have specific requirements that are not met by the built-in environments.
🌐
GitHub
github.com › jestjs › jest › issues › 12573
[Feature]: Allow `@jest-environment` pragma to be below other comments · Issue #12573 · jestjs/jest
March 12, 2022 - 🚀 Feature Proposal Allow the /** * @jest-environment jsdom */ To not be strictly the first comment node. Motivation Docusaurus has a very strict eslint header config that only allows: /** * Copyrig...
Author   Josh-Cena
🌐
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 });
🌐
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
🌐
GitHub
github.com › jestjs › jest › issues › 6634
@jest-environment node not working · Issue #6634 · jestjs/jest
July 5, 2018 - /** * @jest-environment node */ import { URL } from './config'; describe('Config on NodeJS environment', () => { test('it should be a relative url', () => { expect(URL).toBeFalsy(); }); });
Author   StefanoSega
🌐
jsDocs.io
jsdocs.io › package › jest-environment-node
jest-environment-node@30.2.0 - jsDocs.io
@jest/environment · @jest/fake-timers · @jest/types · @types/node · jest-mock · jest-util · jest-validate · @jest/test-utils · clsx · No peer dependencies. To add a badge like this oneto your package's README, use the codes available below. You may also use Shields.io to create a custom badge linking to https://www.jsdocs.io/package/jest-environment-node.
🌐
Yarn
yarnpkg.com › package
jest-environment-node
Yarn is a package manager that doubles down as project manager. Whether you work on simple projects or industry monorepos, whether you're an open source developer or an enterprise user, Yarn has your back · First package manager built specifically around workspaces, Yarn lets you split your ...
🌐
GitHub
github.com › jestjs › jest › issues › 3280
@jest-environment jsdom not working · Issue #3280 · jestjs/jest
April 11, 2017 - I'd like to report a bug. What is the current behavior? When setting the jest environment to node in the package.json and using the @jest-environment jsdom docblock in a UI test, jsdom is not available. If the current behavior is a bug, ...
Published   Apr 11, 2017
🌐
npm
npmjs.com › package › jest-environment-node-single-context
jest-environment-node-single-context - npm
January 29, 2024 - One of Jest's key features is context isolation so tests can't have side-effects on other tests by manipulating the global context. In theory that's a good idea but in practice the current implementation messes around with global types in a way which breaks pretty much all instanceof checks in tests against standard types like Uint8Array for example. 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.
      » npm install jest-environment-node-single-context