{"id":14642,"library":"jest-junit-reporter","title":"Jest JUnit Reporter (Legacy)","description":"This entry describes `jest-junit-reporter` version 1.1.0, a utility for generating JUnit XML test reports from Jest test results. Published 9 years ago, this specific package is effectively abandoned and is no longer maintained. It leverages Jest's `testResultsProcessor` configuration option to intercept test outcomes and format them into a `test-results.xml` file. For any new projects or migrations, the actively maintained and recommended alternative is `jest-junit` (currently at version 16.0.0), which offers more features, better compatibility with modern Jest versions, and uses the `reporters` array configuration (as `testResultsProcessor` is deprecated by Jest itself). This legacy reporter's configuration is limited to environment variables like `TEST_REPORT_PATH` and `TEST_REPORT_FILENAME` for output location and filename. Due to its age, it may have compatibility issues with newer Node.js or Jest versions.","status":"abandoned","version":"1.1.0","language":"javascript","source_language":"en","source_url":"https://github.com/michaelleeallen/jest-junit-reporter","tags":["javascript","jest","junit","reporter"],"install":[{"cmd":"npm install jest-junit-reporter","lang":"bash","label":"npm"},{"cmd":"yarn add jest-junit-reporter","lang":"bash","label":"yarn"},{"cmd":"pnpm add jest-junit-reporter","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"Used for generating the XML output.","package":"xml","optional":false}],"imports":[],"quickstart":{"code":"{\n  \"name\": \"my-jest-project\",\n  \"version\": \"1.0.0\",\n  \"description\": \"A simple project demonstrating jest-junit-reporter (legacy).\",\n  \"main\": \"index.js\",\n  \"scripts\": {\n    \"test\": \"jest\"\n  },\n  \"devDependencies\": {\n    \"jest\": \"^27.0.0\",\n    \"jest-junit-reporter\": \"^1.1.0\"\n  },\n  \"jest\": {\n    \"testResultsProcessor\": \"./node_modules/jest-junit-reporter\"\n  }\n}\n\n// Example test file (sum.test.js)\nfunction sum(a, b) {\n  return a + b;\n}\n\ndescribe('sum', () => {\n  test('adds 1 + 2 to equal 3', () => {\n    expect(sum(1, 2)).toBe(3);\n  });\n\n  test('adds 5 + 10 to equal 15', () => {\n    expect(sum(5, 10)).toBe(15);\n  });\n\n  test('should handle negative numbers', () => {\n    expect(sum(-1, -1)).toBe(-2);\n  });\n});\n\n// To run this and generate the report:\n// 1. npm install\n// 2. npm test\n// This will create a 'test-results.xml' file in the project root.","lang":"javascript","description":"Demonstrates how to configure and use the `jest-junit-reporter` via `package.json` to generate a JUnit XML report."},"warnings":[{"fix":"Migrate to using the `reporters` array in your Jest configuration with a modern JUnit reporter like `jest-junit`. Example: `reporters: ['default', ['jest-junit', { outputDirectory: 'reports', outputName: 'junit.xml' }]]`.","message":"The `testResultsProcessor` configuration option in Jest, which `jest-junit-reporter` uses, is deprecated and may be removed in future Jest versions.","severity":"deprecated","affected_versions":">=jest@27.0.0"},{"fix":"Switch to `jest-junit` (npm package), which is actively maintained and supports modern Jest features and Node.js versions. Install `npm i -D jest-junit`.","message":"The `jest-junit-reporter` package (v1.1.0) is abandoned, with its last publish date 9 years ago. It is no longer maintained and may have compatibility issues with recent Node.js or Jest versions.","severity":"breaking","affected_versions":"all"},{"fix":"If you must use this legacy reporter, ensure these environment variables are correctly set before running Jest. For `jest-junit`, configuration can be done via reporter options, a `jest-junit` key in `package.json`, or dedicated environment variables like `JEST_JUNIT_OUTPUT_DIR` and `JEST_JUNIT_OUTPUT_NAME`.","message":"Configuration for `jest-junit-reporter` (v1.1.0) relies solely on environment variables (`TEST_REPORT_PATH`, `TEST_REPORT_FILENAME`) to customize the output file path and name. This differs significantly from modern Jest reporters.","severity":"gotcha","affected_versions":"all"}],"env_vars":null,"last_verified":"2026-04-19T00:00:00.000Z","next_check":"2026-07-18T00:00:00.000Z","problems":[{"fix":"Ensure `jest-junit-reporter` is listed in your `devDependencies` and run `npm install`. Verify the path in `jest.testResultsProcessor` points to the correct location (e.g., `./node_modules/jest-junit-reporter`).","cause":"The `jest-junit-reporter` package is not correctly installed or the path in `testResultsProcessor` is incorrect.","error":"Error: Could not resolve a module for a custom reporter. Module name: ./node_modules/jest-junit-reporter"},{"fix":"Check Jest's console output for errors. Ensure tests are actually running. If using `TEST_REPORT_PATH` or `TEST_REPORT_FILENAME` environment variables, verify they are correctly set and accessible to the Jest process.","cause":"Jest might not be running the `testResultsProcessor` due to an error, or the output path/filename is being overridden unexpectedly.","error":"No 'test-results.xml' file generated."},{"fix":"Migrate to the `reporters` array in your Jest configuration. Consider switching to the `jest-junit` package for modern compatibility and features.","cause":"Jest is actively warning about the use of `testResultsProcessor`.","error":"DeprecationWarning: The 'testResultsProcessor' option is deprecated and will be removed in a future release."}],"ecosystem":"npm"}