{"id":14640,"library":"jest-environment-node-debug","title":"Jest Node Debug Environment (Fixed)","description":"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.","status":"abandoned","version":"2.0.0","language":"javascript","source_language":"en","source_url":"https://github.com/NikhilVerma/jest-environment-node-debug-fixed","tags":["javascript","jest","node","debug","inspector","devtools"],"install":[{"cmd":"npm install jest-environment-node-debug","lang":"bash","label":"npm"},{"cmd":"yarn add jest-environment-node-debug","lang":"bash","label":"yarn"},{"cmd":"pnpm add jest-environment-node-debug","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"This package provides a custom Jest test environment. Jest is required to use it.","package":"jest","optional":false}],"imports":[{"note":"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.","symbol":"testEnvironment","correct":"// jest.config.js\nmodule.exports = { testEnvironment: 'jest-environment-node-debug-fixed' };"}],"quickstart":{"code":"// package.json\n{\n  \"name\": \"my-jest-app\",\n  \"version\": \"1.0.0\",\n  \"devDependencies\": {\n    \"jest\": \"^29.0.0\",\n    \"jest-environment-node-debug-fixed\": \"2.0.0\",\n    \"ts-jest\": \"^29.0.0\",\n    \"typescript\": \"^5.0.0\"\n  },\n  \"scripts\": {\n    \"test\": \"jest\",\n    \"test:debug\": \"node --inspect-brk node_modules/.bin/jest --runInBand --config ./jest.config.js\"\n  }\n}\n\n// jest.config.js\nmodule.exports = {\n  testEnvironment: 'jest-environment-node-debug-fixed',\n  roots: ['<rootDir>/src'],\n  testMatch: ['**/__tests__/**/*.ts', '**/?(*.)+(spec|test).ts'],\n  transform: {\n    '^.+\\.ts$': 'ts-jest'\n  },\n  globals: {\n    'ts-jest': {\n      tsconfig: 'tsconfig.json'\n    }\n  }\n};\n\n// tsconfig.json\n{\n  \"compilerOptions\": {\n    \"target\": \"ESNext\",\n    \"module\": \"CommonJS\",\n    \"strict\": true,\n    \"esModuleInterop\": true,\n    \"skipLibCheck\": true,\n    \"forceConsistentCasingInFileNames\": true\n  }\n}\n\n// src/__tests__/example.test.ts\ndescribe('My Debuggable Test Suite', () => {\n  test('should perform a basic calculation', () => {\n    const a = 10;\n    const b = 20;\n    // Add a debugger statement to pause execution\n    // debugger;\n    const result = a + b;\n    expect(result).toBe(30);\n  });\n});\n\n// To debug:\n// 1. Open Chrome and navigate to chrome://inspect\n// 2. In your terminal, run: npm run test:debug\n// 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.","lang":"typescript","description":"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."},"warnings":[{"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.","message":"This 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.","severity":"deprecated","affected_versions":">=20.0.0 (Jest)"},{"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.","message":"The 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.","severity":"gotcha","affected_versions":">=8.0.0 (Node.js), >=20.0.0 (Jest)"}],"env_vars":null,"last_verified":"2026-04-19T00:00:00.000Z","next_check":"2026-07-18T00:00:00.000Z","problems":[{"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.","cause":"The package is not installed, or the path in `jest.config.js` is incorrect.","error":"Error: Cannot find module 'jest-environment-node-debug-fixed'"},{"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.","cause":"Jest might be running tests in parallel processes, or the debugger is not properly attached/configured.","error":"Debugger listening on ws://... but breakpoints are not hit."}],"ecosystem":"npm"}