Registry / testing / jest-environment-node-debug

jest-environment-node-debug

JSON →
library2.0.0jsnpmunverified

The `jest-environment-node-debug-fixed` package was developed to resolve debugging challenges encountered when using Jest versions up to around 19 with Node.js 7. It provided a specialized test environment to facilitate debugging, especially with external tools like `devtool` or the native Node.js Inspector. This 'fixed' version aimed to patch compatibility issues that prevented seamless debugging in those specific, older environments. However, with significant advancements in Jest (currently stable at 30.x) and Node.js, native debugging capabilities have become robust and universally supported. Modern Jest integrates directly with Node's inspector protocol, enabling streamlined debugging through IDEs like VS Code or browser developer tools without the need for custom environments. The package's release cadence was ad-hoc, responding to specific compatibility hurdles of its era, and it has not been updated to support contemporary Jest or Node.js versions, making it largely obsolete for current development workflows.

npm install jest-environment-node-debug
INSTALL
IMPORT
SIG · JEST-ENVIRONMENT-N
J
jest-environment-node-debug
testingjavascriptv2.0.0
Install
Import
Disk
Pass rate
0/ 6
Env Coverage0 / 6
glibc
1822
musl
1822
Install & Compatibility
Where this runs
tested against v? · npm install
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
node 18226 runs
build_error
glibc
node 18226 runs
build_error
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

testEnvironment
// jest.config.js module.exports = { testEnvironment: 'jest-environment-node-debug-fixed' };
This environment is configured via the `testEnvironment` option in `jest.config.js`, not through a direct import statement in source code. Ensure the package is installed as a dev dependency.

Demonstrates how to configure Jest to use `jest-environment-node-debug-fixed` and initiate a debugging session using Node's inspector with a simple TypeScript test file.

// package.json { "name": "my-jest-app", "version": "1.0.0", "devDependencies": { "jest": "^29.0.0", "jest-environment-node-debug-fixed": "2.0.0", "ts-jest": "^29.0.0", "typescript": "^5.0.0" }, "scripts": { "test": "jest", "test:debug": "node --inspect-brk node_modules/.bin/jest --runInBand --config ./jest.config.js" } } // jest.config.js module.exports = { testEnvironment: 'jest-environment-node-debug-fixed', roots: ['<rootDir>/src'], testMatch: ['**/__tests__/**/*.ts', '**/?(*.)+(spec|test).ts'], transform: { '^.+\.ts$': 'ts-jest' }, globals: { 'ts-jest': { tsconfig: 'tsconfig.json' } } }; // tsconfig.json { "compilerOptions": { "target": "ESNext", "module": "CommonJS", "strict": true, "esModuleInterop": true, "skipLibCheck": true, "forceConsistentCasingInFileNames": true } } // src/__tests__/example.test.ts describe('My Debuggable Test Suite', () => { test('should perform a basic calculation', () => { const a = 10; const b = 20; // Add a debugger statement to pause execution // debugger; const result = a + b; expect(result).toBe(30); }); }); // To debug: // 1. Open Chrome and navigate to chrome://inspect // 2. In your terminal, run: npm run test:debug // 3. In chrome://inspect, click "Open dedicated DevTools for Node" and then "inspect" for the Jest process. The debugger will pause at the first line of Jest's CLI.
Debug
Known issues
deprecatedThis package is largely obsolete. Modern Jest (v20+, current 30.x) provides robust built-in debugging capabilities via Node's `--inspect` flag and IDE integrations, making this custom environment unnecessary for most users. Using it with newer Jest versions may lead to compatibility issues or unexpected behavior.
fix
Remove `jest-environment-node-debug-fixed` from `devDependencies` and `jest.config.js`. Use native Jest debugging with `node --inspect-brk node_modules/.bin/jest --runInBand` and configure your IDE (VS Code, IntelliJ) as per Jest documentation.
affects: >=20.0.0 (Jest)
gotchaThe package explicitly targets Node.js 7 and Jest 18/19. Attempting to use it with significantly newer Node.js or Jest versions (e.g., Node.js 16+, Jest 27+) is likely to result in errors due to API changes or deprecations.
fix
Verify your Jest and Node.js versions. If using modern versions, switch to native Jest debugging. If you are restricted to ancient versions, ensure compatibility with Node.js 7 and Jest 18/19.
affects: >=8.0.0 (Node.js), >=20.0.0 (Jest)
Errors
Common errors & fixes
Error: Cannot find module 'jest-environment-node-debug-fixed'
The package is not installed, or the path in `jest.config.js` is incorrect.
fix
Ensure `npm install jest-environment-node-debug-fixed --save-dev` has been run and the `testEnvironment` path in `jest.config.js` correctly points to the package name.
Debugger listening on ws://... but breakpoints are not hit.
Jest might be running tests in parallel processes, or the debugger is not properly attached/configured.
fix
Ensure Jest is run with `--runInBand` (e.g., `node --inspect-brk node_modules/.bin/jest --runInBand`). Also, verify your IDE's debugger configuration or open `chrome://inspect` and connect to the correct Node.js process. Adding a `debugger;` statement directly in your test code can force a pause and confirm debugger attachment.
Upgrade
Version history
2.0.0latest on npm
Audit
Dependencies
jestrequiredThis package provides a custom Jest test environment. Jest is required to use it.
Agent activity
4 hits · last 30 days
node
4
Resources
jest-environment-node-debug — npm install jest-environment-node-debug · libregistry