Registry / testing / allure-store

allure-store

JSON →
library1.2.0jsnpmunverified

allure-store provides a flexible and extensible data store for interacting with Allure test results. It offers a unified API, the AllureStore, to read, write, and transform various Allure data entities like test results, containers, categories, environment information, and executor details. The library supports reading from traditional `allure-results` directories, as well as compiled Allure2 reports (local directories, HTML files, or HTTP/HTTPS URLs), and allows writing data back. It is currently at version 1.2.0, with a relatively active release cadence since its initial release in late 2024, focusing on feature enhancements and bug fixes. Key differentiators include its pluggable `AllureReader` and `AllureWriter` interfaces, enabling custom storage backends and result aggregation capabilities, making it highly adaptable for CI/CD pipelines or custom reporting tools.

npm install allure-store
INSTALL
IMPORT
SIG · ALLURE-STORE
A
allure-store
testingjavascriptv1.2.0
Install
Import
Disk
Pass rate
0/ 6
Env Coverage0 / 6
glibc
1822
musl
1822
Install & Compatibility
Where this runs
tested against v? · npm install
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
node 18226 runs
build_error
glibc
node 18226 runs
build_error
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

fromDirectory
import { fromDirectory } from 'allure-store';
const { fromDirectory } = require('allure-store');
Primarily designed for ESM and TypeScript; CommonJS `require` is not supported for modern Node.js usage.
fromReport
import { fromReport } from 'allure-store';
const fromReport = require('allure-store').fromReport;
Used for reading compiled Allure2 reports from various sources (local path, URL, HTML file). Explicit named import is correct.
AllureStore
import type { AllureStore } from 'allure-store';
This is a core interface/type for extending or type-checking custom stores. While you instantiate stores via functions like `fromDirectory`, the `AllureStore` interface defines the contract.

This quickstart demonstrates how to initialize an AllureStore from an existing `allure-results` directory, retrieve various Allure test data (all results, latest results, categories), and also shows how to write new environment information to a specified output directory.

import { fromDirectory } from 'allure-store'; (async () => { // Ensure 'allure-results' directory exists and contains Allure data const store = await fromDirectory('allure-results'); // Retrieve all test results found in the store const allResults = await store.getAllResults(); console.log('Total test results:', allResults.length); if (allResults.length > 0) { console.log('First result name:', allResults[0].name); } // Get the latest results, useful for history tracking const latestResults = await store.getLatestResults(); console.log('Latest results per historyId:', Object.keys(latestResults).length); // Fetch defined categories const categories = await store.getCategories(); console.log('Categories loaded:', categories); // Example of writing environment info (requires overwrite: true in fromDirectory if directory exists) const writeStore = await fromDirectory('allure-results-output', { overwrite: true }); await writeStore.writeEnvironmentInfo({ NODE_ENV: process.env.NODE_ENV ?? 'development', BUILD_ID: process.env.BUILD_ID ?? 'local-build' }); console.log('Environment info written to allure-results-output'); })();
Debug
Known issues
gotchaThe project is housed under `wix-incubator` on GitHub, indicating it might be an experimental or early-stage project. While actively maintained, users should be aware of its incubation status regarding long-term support guarantees or potential breaking changes in minor versions.
fix
Monitor GitHub repository for updates and breaking changes. Consider this for non-critical parts of your infrastructure initially.
affects: >=1.0.0
gotchaThis package requires Node.js version 16.14.0 or higher. Running it with older Node.js versions will result in runtime errors due to unsupported syntax or APIs.
fix
Ensure your Node.js environment is updated to version 16.14.0 or newer (e.g., using `nvm install 16` or `nvm use 16`).
affects: >=1.0.0
gotchaWhen using `fromDirectory` to write data, if the target directory already exists and you intend to overwrite its contents, you *must* pass `{ overwrite: true }` in the options. Failing to do so might prevent new data from being written or merged as expected.
fix
Initialize the store with `await fromDirectory('output-dir', { overwrite: true });` if you intend to replace or fully update existing data in the target directory.
affects: >=1.0.0
breakingVersion 1.1.1 included a fix for erroneous properties in the `Category` type. If you were working with custom categories in versions <=1.1.0, your category definitions or consumption might need minor adjustments to align with the corrected type definition.
fix
Review any custom `Category` type implementations or data structures after upgrading to `v1.1.1` or later to ensure compatibility with the refined type definitions.
affects: <=1.1.0
Errors
Common errors & fixes
TypeError: require is not a function
Attempting to use CommonJS `require()` syntax in a module that is ESM-only or within an ESM context.
fix
Update your import statements to use ES module syntax: `import { fromDirectory } from 'allure-store';` and ensure your project is configured for ESM (e.g., `"type": "module"` in `package.json`).
ENOENT: no such file or directory, scandir 'allure-results'
The specified `allure-results` directory does not exist at the given path when calling `fromDirectory`.
fix
Verify the path to your Allure results directory is correct and that the directory actually exists. Create it if you intend to write to it and it's missing, or ensure a test runner has generated results there.
TypeError: store.writeEnvironmentInfo is not a function
The `AllureStore` instance was created in a read-only mode or you are attempting to call a write method on an interface that only supports reading (e.g., a custom `AllureReader` implementation that doesn't also implement `AllureWriter`).
fix
Ensure you are using a store initialized with write capabilities, such as `fromDirectory`, and if overwriting is intended for an existing directory, pass `{ overwrite: true }` in options for `fromDirectory`.
Upgrade
Version history
1.2.0latest on npm
Audit
Dependencies

No dependency data recorded yet.

Agent activity
44 hits · last 30 days
node
38
OpenAI (training)
1
Resources
allure-store — npm install allure-store · libregistry