Allure Jasmine configuration

The Allure Jasmine adapter behavior can be affected by some configuration options set in your project's setup.js or setup.ts file (see Prepare your project).

The configuration options must be defined in the object passed to the JasmineAllureReporter constructor. Also, some additional data may be passed to the allure object's methods.

JavaScript
import { JasmineAllureReporter } from "allure-jasmine"; const reporter = new JasmineAllureReporter({}); jasmine.getEnv().addReporter(reporter); export const allure = reporter.getInterface();
JavaScript
import { JasmineAllureReporter } from "allure-jasmine"; import { Status, TestResult } from "allure-js-commons"; const reporter = new JasmineAllureReporter({ resultsDir: "./allure-results", testMapper: (result: TestResult) => { if (result.status == Status.SKIPPED) { result.fullName = `(WAS SKIPPED) ${result.fullName}`; } return result; }, }); jasmine.getEnv().addReporter(reporter); export const allure = reporter.getInterface(); allure.writeEnvironmentInfo({ os_platform: os.platform(), os_release: os.release(), os_version: os.version(), node_version: process.version, }); allure.writeCategoriesDefinitions([ { name: "Sad tests", messageRegex: /.*Sad.*/, matchedStatuses: [Status.FAILED], }, { name: "Infrastructure problems", messageRegex: ".*RuntimeException.*", matchedStatuses: [Status.BROKEN], }, { name: "Outdated tests", messageRegex: ".*FileNotFound.*", matchedStatuses: [Status.BROKEN], }, { name: "Regression", messageRegex: ".*\\sException:.*", matchedStatuses: [Status.BROKEN], }, ]);

resultsDir

Path to the directory where Allure Jasmine will save the test results, see How it works. If the directory does not exist, it will be created. Defaults to allure-results.

testMapper

A function for custom post-processing test results. For example, it can alter a title or a list of attachments based on your custom logic. The function should both accept and return a TestResult object.

allure.writeEnvironmentInfo()

Set data for the Environment information block in the test report.

allure.writeCategoriesDefinitions()

Define custom categories that will be used to distinguish test results, see Details panel.

This setting is an array, each item being an object representing one custom category. The objects may have the following properties:

  • name — the category name.
  • messageRegex — regular expression that the test result's message should match.
  • traceRegex — regular expression that the test result's trace should match.
  • matchedStatuses — array of statuses that the test result should be one of.
  • flaky — whether the test result should be flaky or not flaky.
Powered by
logo

Join our newsletter

Join our community

We aim to make Allure Report as reliable and user-friendly as possible, and together with the community, we're here to help when problems arise.

© 2024 Qameta Software Inc. All rights reserved.