Jest-Allure2
An up to date Jest reporter that produces Allure 2 reports.
Originally forked from jest-allure, this project uses the latest allure configuration ^2.0.0-beta.6
.
Allure Framework is a flexible lightweight multi-language test report tool that not only shows a very concise representation of what have been tested in a neat web report form, but allows everyone participating in the development process to extract maximum of useful information from everyday execution of tests.
Features:
-
Most robust Allure API currently available to Jest.
-
Support for new attachment types that were not supported on previous versions.
-
Allure result files are now JSON, replacing the legacy XML format.
Requirements
Resource | Description |
---|---|
Jest | A delightful JavaScript testing framework. |
Allure 2 CLI | "A Java jar command line tool that turns Allure result files into beautiful Allure reports." |
🚀 Quick start
- Add this package
yarn add --dev jest-allure2
- Update
jest.setup.js
var registerAllure =
- Run tests
yarn test
- Generate the Allure report
allure generate
Advanced features
Add descriptions, screenshots, steps, severity and lots of other fancy details to the report.
The global
variable will have a new allure
object available with the following methods:
alluredescriptiondescription: string: this; allure: this; allure: this; allure: this; allure: this; allure: this; allure: this; allure: this; allurelabelname: string value: string: this; allure: this; allure: this; allure: this; allure: this;
Example
// Test subject: number { return a + b} // Tests
⚙️ Options
The main export registerAllure()
accepts three optional configuration arguments:
Parameter | Description | Default |
---|---|---|
resultsDir | File path where result files are written. | "allure-results" |
environmentInfo | Key value pairs that will appear under the environment section of the Allure report | {} |
testMapper | Decorator that receives Allure test result objects. | undefined |
// jest.setup.jsvar resultsDir = 'allure-results'var environmentInfo = Username: 'User-1331' password: 'password-1331' var { if resultstatus == StatusSKIPPED resultfullName = `(WAS SKIPPED) ` return result}