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
.
You can find example setup and usage in this repo
Currently, we don't have official solution for circus test runner. Consider using this community plugin instead
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;
}
module.exports = {
testRunner: "jest-jasmine2",
preset: "ts-jest",
setupFilesAfterEnv: ["./allure-setup.ts"],
};