---
title: Node.js Test Runner configuration
description: Configuration properties for Allure Node.js Test Runner | Change allure-results directory | Set up link templates and categories
---

# Allure Node.js Test Runner configuration

The [Allure Node.js Test Runner](/docs/node-test/) integration behavior can be configured through environment variables.

## Providing configuration

Node.js does not pass an options object to custom test reporters, so the configuration is provided through environment variables. Most options are set via the `ALLURE_NODE_TEST_CONFIG` variable, which holds a JSON object:

**MacOS/Linux:**
```bash
export ALLURE_NODE_TEST_CONFIG='{"resultsDir":"allure-results","globalLabels":{"layer":"api"}}'
node --test --import allure-node-test/setup --test-reporter allure-node-test/reporter
```

**Windows:**
```powershell
$Env:ALLURE_NODE_TEST_CONFIG = '{"resultsDir":"allure-results","globalLabels":{"layer":"api"}}'
node --test --import allure-node-test/setup --test-reporter allure-node-test/reporter
```

An example that combines the supported properties:

```json
{
  "resultsDir": "allure-results",
  "links": {
    "issue": {
      "nameTemplate": "Issue #%s",
      "urlTemplate": "https://issues.example.com/%s"
    },
    "tms": {
      "nameTemplate": "TMS #%s",
      "urlTemplate": "https://tms.example.com/%s"
    },
    "jira": {
      "urlTemplate": "https://jira.example.com/browse/%s"
    }
  },
  "categories": [
    {
      "name": "foo",
      "messageRegex": "bar",
      "traceRegex": "baz",
      "matchedStatuses": ["failed", "broken"]
    }
  ],
  "environmentInfo": {
    "os_platform": "linux",
    "node_version": "26.1.0"
  },
  "globalLabels": {
    "layer": "api"
  }
}
```

Because the configuration is JSON, only values that can be represented as JSON are supported. Configuration options that require functions — listeners and link template functions — are not available.

## resultsDir

Path to the directory where the test results will be saved, see [How it works](/docs/how-it-works/). If the directory does not exist, it will be created. Defaults to `allure-results`.

You can also set the output directory using the `ALLURE_RESULTS_DIR` environment variable. The `resultsDir` option takes priority over `ALLURE_RESULTS_DIR` if both are set.

**MacOS/Linux:**
```bash
export ALLURE_RESULTS_DIR=out/allure-results
node --test --import allure-node-test/setup --test-reporter allure-node-test/reporter
```

**Windows:**
```powershell
$Env:ALLURE_RESULTS_DIR = "out/allure-results"
node --test --import allure-node-test/setup --test-reporter allure-node-test/reporter
```

## links

A mapping of templates that can be used to construct full URLs from short identifiers.

For each type of link (see [`allure.link()`](/docs/node-test-reference/#link)), you can specify the following:

- `nameTemplate` — a template for generating the link name when it is not provided.
- `urlTemplate` — a template for generating the full link address when the provided value is an identifier rather than a full URL.

Both templates must contain `%s` at the position where the identifier should be placed.

For example, with the configuration above, `await allure.issue("123")` will produce a link with the name `Issue #123` and the address `https://issues.example.com/123`. Allure will display the link with the appropriate icon for the `issue` type.

## categories

Define custom categories that will be used to distinguish test results by their errors; see [Categories](/docs/categories/).

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

- `name` — a category name.
- `description` — a description of the category.
- `descriptionHtml` — a description of the category, in HTML format.
- `messageRegex` — a regular expression that the test result's message should match.
- `traceRegex` — a regular expression that the test result's trace should match.
- `matchedStatuses` — an array of statuses that the test result should be one of. The valid statuses are `"failed"`, `"broken"`, `"passed"`, and `"skipped"`.
- `flaky` — whether the test result should be marked as [flaky](/docs/test-stability/#flaky-tests).

## environmentInfo

Key-value pairs that will be displayed on the report's main page, see [Environment information](/docs/v2/readability/#environment-information).

## globalLabels

Labels applied to every test result in the run. Useful for tagging all results with a layer, team, or environment identifier without repeating it in every test.

Can be provided as an array of `{ "name": ..., "value": ... }` label objects:

```json
{
  "globalLabels": [
    { "name": "layer", "value": "api" },
    { "name": "team", "value": "backend" }
  ]
}
```

Or as a plain object mapping label names to values. A name can map to a single string or an array of strings:

```json
{
  "globalLabels": {
    "layer": "api",
    "team": "backend"
  }
}
```

## Other environment variables

Besides `ALLURE_NODE_TEST_CONFIG` and `ALLURE_RESULTS_DIR`, the integration recognizes the following environment variables:

- `ALLURE_TESTPLAN_PATH` — a path to a test plan file used to [select which tests to run](/docs/node-test/#select-tests-via-a-test-plan-file).
- `ALLURE_LABEL_⟨NAME⟩` — [set a label globally](/docs/node-test/#set-labels-globally) for all tests in the run.
