jest-allure2-reporter is an idiomatic Jest reporter that integrates with the Allure Framework, enabling the generation of rich, interactive test reports. It is currently at version 2.3.0 and actively maintained with a regular release cadence, including frequent bug fixes and feature updates (e.g., support for Jest 30). Key differentiators include its ability to visualize detailed test execution flows with step-by-step breakdowns, attach various artifacts (screenshots, logs, JSON data) to tests, and provide comprehensive test metadata through both programmatic APIs and JSDocblock pragmas. The library offers robust TypeScript support and features like the `@Step` decorator for defining test steps and capabilities for visual regression testing, providing a more detailed and debuggable testing experience compared to standard Jest reporters.
npm install jest-allure2-reporterVerified import paths — ran on the pinned version, not inferred.
This quickstart demonstrates how to configure jest-allure2-reporter in `jest.config.js`, define test steps using the `@Step` decorator, add attachments and metadata with the `allure` API, and generate the final Allure report.
Install globally: `npm install -g allure-commandline` or `yarn global add allure-commandline`.
Ensure your Jest version meets the peer dependency requirement (`jest@>=27.2.5`). Upgrade `jest` to at least `27.2.5`, preferably the latest stable version compatible with `jest-allure2-reporter`.
Add `"experimentalDecorators": true, "emitDecoratorMetadata": true` to your `compilerOptions` in `tsconfig.json`.
Update your `jest.config.js` to include: `testEnvironment: 'jest-allure2-reporter/environment-node'` (or `.../environment-jsdom`).
Upgrade your Node.js environment to version 16.20.0 or higher.
Ensure `jest-allure2-reporter` is installed (`npm install --save-dev jest-allure2-reporter`) and correctly listed in `jest.config.js` reporters array.
Verify `jest.config.js` includes `testEnvironment: 'jest-allure2-reporter/environment-node'` (or `.../environment-jsdom`) and that `allure` or `Step` are imported from `'jest-allure2-reporter/api'`.
Ensure you have imported `allure` from `'jest-allure2-reporter/api'` in your TypeScript files. Also, verify your `tsconfig.json` correctly includes `node_modules/@types` or relevant type declarations.
Install the Allure command line tool globally: `npm install -g allure-commandline`.