Skip to content

Latest commit

 

History

History
54 lines (37 loc) · 1.87 KB

README.md

File metadata and controls

54 lines (37 loc) · 1.87 KB

allure-jasmine

Allure integration Jasmine framework

Allure Report logo


For usage example see test/Setup.ts

Usage with Jest (jest@<27)

Use your favorite node package manager to install required packages:

npm add -D jest-jasmine2 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 your jest.config.js file:

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

You can find example setup and usage in this repo