Skip to content

Latest commit

 

History

History
47 lines (33 loc) · 1.29 KB

README.md

File metadata and controls

47 lines (33 loc) · 1.29 KB

Allure integration for jest framework

Warning This integration doesn't work with default runner since jest 27+. To use this integration after jest 27 you need to change default runner to Jasmine.

Examples

You can find example setup and usage in this repo

Circus test runner (default for jest@^27)

Currently, we don't have official solution for circus test runner. Consider using this community plugin instead

Jasmine test runner (default for jest@<27)

Install dependencies

npm i -D jest-jasmine2@INSTALLED_JEST_VERSION allure-jasmine allure-js-commons @types/jasmine

Create allure-setup.ts file:

import { JasmineAllureReporter } from "allure-jasmine";
import { JasmineAllureInterface } from "allure-jasmine/dist/src/JasmineAllureReporter";

const reporter = new JasmineAllureReporter({ resultsDir: "allure-results" });
jasmine.getEnv().addReporter(reporter);
// @ts-expect-error
global.allure = reporter.getInterface();

declare global {
  const allure: JasmineAllureInterface;
}

Change jest.config.js

module.exports = {
  testRunner: "jest-jasmine2",
  preset: "ts-jest",
  setupFilesAfterEnv: ["./allure-setup.ts"],
};