Allure Node.js Test Runner configuration
The Allure Node.js Test Runner 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:
export ALLURE_NODE_TEST_CONFIG='{"resultsDir":"allure-results","globalLabels":{"layer":"api"}}'
node --test --import allure-node-test/setup --test-reporter allure-node-test/reporter$Env:ALLURE_NODE_TEST_CONFIG = '{"resultsDir":"allure-results","globalLabels":{"layer":"api"}}'
node --test --import allure-node-test/setup --test-reporter allure-node-test/reporterAn example that combines the supported properties:
{
"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. 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.
export ALLURE_RESULTS_DIR=out/allure-results
node --test --import allure-node-test/setup --test-reporter allure-node-test/reporter$Env:ALLURE_RESULTS_DIR = "out/allure-results"
node --test --import allure-node-test/setup --test-reporter allure-node-test/reporterlinks
A mapping of templates that can be used to construct full URLs from short identifiers.
For each type of link (see allure.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.
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.
environmentInfo
Key-value pairs that will be displayed on the report's main page, see 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:
{
"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:
{
"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.ALLURE_LABEL_⟨NAME⟩— set a label globally for all tests in the run.