{"id":11136,"library":"jest-allure2-reporter","title":"Allure Reporter for Jest","description":"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.","status":"active","version":"2.3.0","language":"javascript","source_language":"en","source_url":"https://github.com/wix-incubator/jest-allure2-reporter","tags":["javascript","allure","allure2","jest","jest-reporter","reporter","typescript"],"install":[{"cmd":"npm install jest-allure2-reporter","lang":"bash","label":"npm"},{"cmd":"yarn add jest-allure2-reporter","lang":"bash","label":"yarn"},{"cmd":"pnpm add jest-allure2-reporter","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"Required peer dependency for Jest test runner.","package":"jest","optional":false},{"reason":"Peer dependency for processing JSDocblock pragmas in test files.","package":"jest-docblock","optional":false}],"imports":[{"note":"The reporter is configured as a string in Jest's `reporters` array, not directly imported.","wrong":"import { AllureReporter } from 'jest-allure2-reporter';","symbol":"jest-allure2-reporter","correct":"// jest.config.js\nmodule.exports = {\n  reporters: [\n    'default',\n    'jest-allure2-reporter'\n  ]\n};"},{"note":"The test environment is specified as a string path in Jest configuration. Use `environment-jsdom` for browser tests.","wrong":"import { NodeEnvironment } from 'jest-allure2-reporter/environment-node';","symbol":"environment-node","correct":"// jest.config.js\nmodule.exports = {\n  testEnvironment: 'jest-allure2-reporter/environment-node'\n};"},{"note":"The `allure` object for programmatic API access (e.g., adding steps, attachments, metadata) must be imported from the specific `api` subpath.","wrong":"import allure from 'jest-allure2-reporter';","symbol":"allure","correct":"import { allure } from 'jest-allure2-reporter/api';"},{"note":"The `@Step` decorator, like the `allure` object, is exported from the `api` subpath for use in test files.","wrong":"import { Step } from 'jest-allure2-reporter';","symbol":"Step","correct":"import { Step } from 'jest-allure2-reporter/api';"}],"quickstart":{"code":"/* jest.config.js */\n/** @type {import('@jest/types').Config.InitialOptions} */\nmodule.exports = {\n  reporters: [\n    'default',\n    'jest-allure2-reporter'\n  ],\n  testEnvironment: 'jest-allure2-reporter/environment-node'\n};\n\n/* my-page.ts */\nimport { allure, Step } from 'jest-allure2-reporter/api';\n\nexport class MyPage {\n  @Step('Load user data for ID: {{userId}}')\n  async loadUserData(userId: string) {\n    const userData = { name: 'John Doe', id: userId };\n    allure.attachment('User Data', JSON.stringify(userData, null, 2), 'application/json');\n    return userData;\n  }\n}\n\n/* my.test.ts */\nimport { allure } from 'jest-allure2-reporter/api';\nimport { MyPage } from './my-page';\n\ndescribe('User Profile', () => {\n  const page = new MyPage();\n\n  it('should load user data correctly', async () => {\n    allure.feature('Profile');\n    allure.severity('critical');\n    const userData = await page.loadUserData('user123');\n    expect(userData.name).toBe('John Doe');\n  });\n});\n\n// To generate and open reports after tests:\n// npm install -g allure-commandline\n// allure generate allure-results --clean\n// allure open","lang":"typescript","description":"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."},"warnings":[{"fix":"Install globally: `npm install -g allure-commandline` or `yarn global add allure-commandline`.","message":"The Allure command line tool (`allure-commandline`) is a separate dependency and must be installed globally or locally to generate and serve reports after tests complete. This package only generates the raw Allure results.","severity":"gotcha","affected_versions":">=1.0.0"},{"fix":"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`.","message":"Older versions of Jest (below 27.2.5) are not supported. This reporter requires Jest 27.2.5 or higher. Compatibility fixes for Jest 30 were introduced in v2.2.1.","severity":"breaking","affected_versions":"<2.2.1"},{"fix":"Add `\"experimentalDecorators\": true, \"emitDecoratorMetadata\": true` to your `compilerOptions` in `tsconfig.json`.","message":"If using TypeScript decorators like `@Step`, ensure `experimentalDecorators` and `emitDecoratorMetadata` are enabled in your `tsconfig.json`.","severity":"gotcha","affected_versions":">=1.0.0"},{"fix":"Update your `jest.config.js` to include: `testEnvironment: 'jest-allure2-reporter/environment-node'` (or `.../environment-jsdom`).","message":"The `testEnvironment` must be explicitly set to either `jest-allure2-reporter/environment-node` (for Node.js tests) or `jest-allure2-reporter/environment-jsdom` (for browser-like tests). Failing to do so will result in Allure APIs not being available in your tests.","severity":"gotcha","affected_versions":">=1.0.0"},{"fix":"Upgrade your Node.js environment to version 16.20.0 or higher.","message":"Node.js versions older than 16.20.0 are not supported by the package. Running on unsupported Node.js versions may lead to unexpected errors or failures.","severity":"breaking","affected_versions":"<=2.3.0"}],"env_vars":null,"last_verified":"2026-04-19T00:00:00.000Z","next_check":"2026-07-18T00:00:00.000Z","problems":[{"fix":"Ensure `jest-allure2-reporter` is installed (`npm install --save-dev jest-allure2-reporter`) and correctly listed in `jest.config.js` reporters array.","cause":"The reporter string 'jest-allure2-reporter' is not resolvable by Jest, likely because the package is not installed or incorrectly referenced.","error":"Error: Jest: a reporter 'jest-allure2-reporter' cannot be found."},{"fix":"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'`.","cause":"The `allure` object or `@Step` decorator is not available in the global scope or imported incorrectly, often due to an incorrect `testEnvironment` setting.","error":"ReferenceError: allure is not defined"},{"fix":"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.","cause":"When using TypeScript, the types for the `allure` object might not be correctly picked up by the compiler.","error":"Cannot find name 'allure'. Did you mean 'URL'?"},{"fix":"Install the Allure command line tool globally: `npm install -g allure-commandline`.","cause":"The `allure generate` or `allure open` commands are not found because the Allure CLI tool is not installed or not in the system's PATH.","error":"Error: Allure commandline is not installed. Please install it globally `npm install -g allure-commandline`"}],"ecosystem":"npm"}