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.
npm install jest-junit-reporterNo compatibility data collected yet for this library.
Demonstrates how to configure and use the `jest-junit-reporter` via `package.json` to generate a JUnit XML report.
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' }]]`.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`.
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`.
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`).
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.
Migrate to the `reporters` array in your Jest configuration. Consider switching to the `jest-junit` package for modern compatibility and features.