Skip to content
Allure report logoAllure Report
Main Navigation ModulesDocumentationStarter Project

English

Español

English

Español

Appearance

Sidebar Navigation

Allure 3

Install & Upgrade

Install Allure

Upgrade Allure

Configure

Create Reports

How to generate a report

How to view a report

Improving readability of your test reports

Improving navigation in your test report

Reading Allure charts

Migrate from Allure 2

Allure 2

Install & Upgrade

Install for Windows

Install for macOS

Install for Linux

Install for Node.js

Upgrade Allure

Create Reports

How to generate a report

How to view a report

Improving readability of your test reports

Improving navigation in your test report

Features

Test steps

Attachments

Test statuses

Assertion diffs

Sorting and filtering

Environments

Multistage Builds

Categories

Visual analytics

Test stability analysis

History and retries

Quality Gate

Global Errors and Attachments

Timeline

Export to CSV

Export metrics

Guides

JUnit 5 parametrization

JUnit 5 & Selenide: screenshots and attachments

JUnit 5 & Selenium: screenshots and attachments

Setting up JUnit 5 with GitHub Actions

Pytest parameterization

Pytest & Selenium: screenshots and attachments

Pytest & Playwright: screenshots and attachments

Pytest & Playwright: videos

Playwright parameterization

Publishing Reports to GitHub Pages

Allure Report 3: XCResults Reader

How it works

Overview

Glossary

Test result file

Container file

Categories file

Environment file

Executor file

History files

Test Identifiers

Integrations

Azure DevOps

Bamboo

GitHub Action

Jenkins

JetBrains IDEs

TeamCity

Visual Studio Code

Frameworks

Behat

Getting started

Configuration

Reference

Behave

Getting started

Configuration

Reference

Bun

Getting started

Configuration

Reference

Codeception

Getting started

Configuration

Reference

CodeceptJS

Getting started

Configuration

Reference

Cucumber.js

Getting started

Configuration

Reference

Cucumber-JVM

Getting started

Configuration

Reference

Cucumber.rb

Getting started

Configuration

Reference

Cypress

Getting started

Configuration

Reference

Jasmine

Getting started

Configuration

Reference

JBehave

Getting started

Configuration

Reference

Jest

Getting started

Configuration

Reference

JUnit 4

Getting started

Configuration

Reference

JUnit 5

Getting started

Configuration

Reference

Mocha

Getting started

Configuration

Reference

Newman

Getting started

Configuration

Reference

NUnit

Getting started

Configuration

Reference

PHPUnit

Getting started

Configuration

Reference

Playwright

Getting started

Configuration

Reference

pytest

Getting started

Configuration

Reference

Pytest-BDD

Getting started

Configuration

Reference

Reqnroll

Getting started

Configuration

Reference

REST Assured

Getting started

Configuration

Robot Framework

Getting started

Configuration

Reference

Rust Cargo Test

Getting started

Configuration

Reference

RSpec

Getting started

Configuration

Reference

SpecFlow

Getting started

Configuration

Reference

Spock

Getting started

Configuration

Reference

TestNG

Getting started

Configuration

Reference

Vitest

Getting started

Configuration

Reference

WebdriverIO

Getting started

Configuration

Reference

xUnit.net

Getting started

Configuration

Reference

On this page

Getting started with Allure Bun ​

Allure Bun npm latest version

Generate beautiful HTML reports using Allure Report and your Bun tests.

INFO

Check out the example projects at github.com/allure-examples to see Allure Bun in action.

Setting up ​

1. Prepare your project ​

  1. Make sure Bun is installed.

  2. Open a terminal and go to the project directory. For example:

    bash
    cd /home/user/myproject
  3. Make sure Allure Report is installed. If it's not, follow the installation instructions. Note that Allure Report requires Java.

  4. Install the Allure Bun integration:

    bash
    npm install --save-dev allure-bun allure-js-commons
    bash
    yarn add --dev allure-bun allure-js-commons
    bash
    pnpm install --dev allure-bun allure-js-commons
    bash
    bun add --dev allure-bun allure-js-commons

    Keep allure-bun and allure-js-commons on the same version.

  5. Add the preload entry to your bunfig.toml:

    toml
    [test]
    preload = ["allure-bun/setup"]

    This registers the integration before any test files are loaded. Your test files themselves do not need any changes — keep using bun:test as usual.

    Optionally, specify resultsDir and other options. See Allure Bun configuration for more details.

2. Run tests ​

Run your Bun tests the same way you would run them usually:

bash
bun test

This will save the necessary data into allure-results or another directory, according to the configuration. If the directory already exists, new files will be added to the existing ones so that a future report will be based on them all.

WARNING

Running tests with --concurrent or --randomize is not supported. Allure Bun will fail fast with a descriptive error if either flag is detected.

All standard bun:test modifiers work as usual: .skip, .todo, .if(), .skipIf(), .todoIf(), and .each() — on both test and describe; plus .failing and .serial on test only. Two exceptions: test.concurrent throws an error, and .only (on both test and describe) is not supported — it causes the same queue-ordering error described in the warning below.

3. Generate a report ​

Finally, convert the test results into an HTML report. This can be done by one of two commands:

  • allure generate processes the test results and saves an HTML report into the allure-report directory. To view the report, use the allure open command.

  • allure serve creates the same report as allure generate, then automatically opens the main page of the report in a web browser.

Writing tests ​

The Allure Bun integration extends the standard reporting features of Bun by providing additional capabilities for crafting more informative and structured tests. This section highlights key enhancements that can be utilized:

  • Metadata Annotation: Enhance test reports with descriptions, links, and other metadata.
  • Test Organization: Structure your tests into clear hierarchies for better readability and organization, see organize tests.
  • Step Division: Break down tests into smaller test steps for easier understanding and maintenance.
  • Parametrized Tests: Clearly describe the parameters for parametrized tests to specify different scenarios.
  • Set labels globally: Use environment variables to set metadata and other labels.
  • Attachments: Capture files and other content during test execution.
  • Test Selection: Use a test plan file to select which tests to run, allowing for flexible test execution.
  • Environment Details: Include comprehensive environment information to accompany the test report.

In most cases, Allure Bun provides two different ways to use a feature: the Runtime API and the Metadata API.

Known limitation: always use describe()

Always place tests inside describe() blocks. Mixing root-level test() calls with describe() blocks in the same file produces the error allure-bun does not support concurrent tests. This is a known limitation: Bun defers describe() callbacks, which causes allure-bun's registration queue to diverge from execution order — the same ordering mechanism it uses to prevent concurrent test execution. test.skip and test.todo are exempt. Files that contain only root-level tests with no describe() blocks are also unaffected.

  • Runtime API: use Allure's functions to add certain data to the test result during its execution. This approach allows for constructing the data dynamically.

    Note that it is recommended to call Allure's functions as close to the beginning of the test as possible. This way, the data will be added even if the test fails early.

  • Metadata API: add a metadata tag (beginning with @) into the test name. Allure Bun will extract it and update the test result's data accordingly. When using this approach, the data is guaranteed to be added regardless of how the test itself runs.

Add Metadata ​

Allure allows you to enrich your reports with a variety of metadata. This additional information provides context and details for each test, enhancing the report's usefulness. Refer to the metadata reference section for an exhaustive list of what can be added.

ts
import * as allure from "allure-js-commons";
import { describe, test } from "bun:test";

describe("authentication", () => {
  test("Test Authentication", async () => {
    await allure.displayName("Test Authentication");
    await allure.owner("John Doe");
    await allure.tags("Web interface", "Authentication");
    await allure.severity("critical");
    // ...
  });
});
ts
import { describe, test } from "bun:test";

describe("authentication", () => {
  test(
    "Test Authentication" +
      " @allure.label.owner:JohnDoe" +
      " @allure.label.tag:WebInterface" +
      " @allure.label.tag:Authentication" +
      " @allure.label.severity:critical",
    async () => {
      // ...
    },
  );
});

Organize tests ​

As described in Improving navigation in your test report, Allure supports multiple ways to organize tests into hierarchical structures.

To specify a test's location in the behavior-based hierarchy:

ts
import * as allure from "allure-js-commons";
import { describe, test } from "bun:test";

describe("authentication", () => {
  test("Test Authentication", async () => {
    await allure.epic("Web interface");
    await allure.feature("Authentication");
    await allure.story("Login with username");
    // ...
  });
});
ts
import { describe, test } from "bun:test";

describe("authentication", () => {
  test(
    "Test Authentication" +
      " @allure.label.epic:WebInterface" +
      " @allure.label.feature:EssentialFeatures" +
      " @allure.label.story:Authentication",
    async () => {
      // ...
    },
  );
});

To specify a test's location in the suite-based hierarchy:

ts
import * as allure from "allure-js-commons";
import { describe, test } from "bun:test";

describe("authentication", () => {
  test("Test Authentication", async () => {
    await allure.parentSuite("Tests for web interface");
    await allure.suite("Tests for essential features");
    await allure.subSuite("Tests for authentication");
    // ...
  });
});
ts
import { describe, test } from "bun:test";

describe("authentication", () => {
  test(
    "Test Authentication" +
      " @allure.label.parentSuite:TestsForWebInterface" +
      " @allure.label.suite:TestsForEssentialFeatures" +
      " @allure.label.subSuite:TestsForAuthentication",
    async () => {
      // ...
    },
  );
});

Divide a test into steps ​

To create steps and sub-steps, you can use the step() function, see the reference.

ts
import * as allure from "allure-js-commons";
import { Status } from "allure-js-commons";
import { describe, test } from "bun:test";

describe("authentication", () => {
  test("Test Authentication", async () => {
    await allure.step("Step 1", async () => {
      await allure.step("Sub-step 1", async (ctx) => {
        await ctx.parameter("foo", "1");
        // ...
      });
      await allure.step("Sub-step 2", async (ctx) => {
        await ctx.parameter("foo", "2");
        // ...
      });
    });
    await allure.logStep("Step 2", Status.SKIPPED);
  });
});

Describe parametrized tests ​

Bun's built-in test.each() makes it straightforward to implement the parametrized tests pattern. Each row in the table is treated as a separate test run by Allure Report.

To display a parameter value in the test report, pass it to the parameter() function.

ts
import * as allure from "allure-js-commons";
import { describe, test } from "bun:test";

describe("authentication", () => {
  for (const login of ["johndoe", "[email protected]"]) {
    test(`Test Authentication as ${login}`, async () => {
      await allure.parameter("login", login);
      await allure.parameter("time", new Date().toUTCString(), { excluded: true });
      // ...
    });
  }
});
ts
import * as allure from "allure-js-commons";
import { describe, test } from "bun:test";

describe("authentication", () => {
  test.each(["johndoe", "[email protected]"])("Test Authentication as %s", async (login) => {
    await allure.parameter("login", login);
    await allure.parameter("time", new Date().toUTCString(), { excluded: true });
    // ...
  });
});

Set labels globally ​

Any labels, including custom ones, can be set via environment variables in your operating system. Here's an example:

bash
export ALLURE_LABEL_epic=WebInterface
bun test
powershell
$Env:ALLURE_LABEL_epic = "WebInterface"
bun test

Attach files ​

In Allure reports, you have the ability to attach various types of files, which can greatly enhance the comprehensibility of the report.

For detailed instructions on how to implement attachments, refer to the attachments section in the Allure Bun reference.

ts
import * as allure from "allure-js-commons";
import { ContentType } from "allure-js-commons";
import { describe, test } from "bun:test";

describe("authentication", () => {
  test("Test Authentication", async () => {
    // ...

    await allure.attachment("Text file", "This is the file content.", ContentType.TEXT);

    await allure.attachmentPath("Screenshot", "/path/to/image.png", {
      contentType: ContentType.PNG,
      fileExtension: "png",
    });
  });
});

Select tests via a test plan file ​

If the ALLURE_TESTPLAN_PATH environment variable is defined and points to an existing file, Bun will only run tests listed in this file.

Here's an example of running tests according to a file named testplan.json:

bash
export ALLURE_TESTPLAN_PATH=testplan.json
bun test
powershell
$Env:ALLURE_TESTPLAN_PATH = "testplan.json"
bun test

Environment information ​

For the main page of the report, you can collect various information about the environment in which the tests were executed. To do so, edit the environmentInfo object in the configuration.

For example, it is a good idea to record the OS version and the Bun runtime version. This may help the future reader investigate bugs that are reproducible only in some environments.

ts
// preload.ts
import type { ReporterConfig } from "allure-js-commons/sdk/reporter";
import * as os from "node:os";

globalThis.allureBunConfig = {
  environmentInfo: {
    os_platform: os.platform(),
    os_release: os.release(),
    os_version: os.version(),
    bun_version: Bun.version,
  },
} satisfies ReporterConfig;

await import("allure-bun/setup");
toml
# bunfig.toml
[test]
preload = ["./preload.ts"]
Pager
Previous pageReference
Next pageConfiguration
Powered by

Subscribe to our newsletter

Get product news you actually need, no spam.

Subscribe
Allure TestOps
  • Overview
  • Why choose us
  • Cloud
  • Self-hosted
  • Success Stories
Company
  • Documentation
  • Blog
  • About us
  • Contact
  • Events
© 2026 Qameta Software Inc. All rights reserved.
A Markdown version of this page is available at /docs/bun.md