{"id":12799,"library":"allure-store","title":"Allure Store","description":"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.","status":"active","version":"1.2.0","language":"javascript","source_language":"en","source_url":"https://github.com/wix-incubator/allure-store","tags":["javascript","allure","typescript"],"install":[{"cmd":"npm install allure-store","lang":"bash","label":"npm"},{"cmd":"yarn add allure-store","lang":"bash","label":"yarn"},{"cmd":"pnpm add allure-store","lang":"bash","label":"pnpm"}],"dependencies":[],"imports":[{"note":"Primarily designed for ESM and TypeScript; CommonJS `require` is not supported for modern Node.js usage.","wrong":"const { fromDirectory } = require('allure-store');","symbol":"fromDirectory","correct":"import { fromDirectory } from 'allure-store';"},{"note":"Used for reading compiled Allure2 reports from various sources (local path, URL, HTML file). Explicit named import is correct.","wrong":"const fromReport = require('allure-store').fromReport;","symbol":"fromReport","correct":"import { fromReport } from 'allure-store';"},{"note":"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.","symbol":"AllureStore","correct":"import type { AllureStore } from 'allure-store';"}],"quickstart":{"code":"import { fromDirectory } from 'allure-store';\n\n(async () => {\n  // Ensure 'allure-results' directory exists and contains Allure data\n  const store = await fromDirectory('allure-results');\n\n  // Retrieve all test results found in the store\n  const allResults = await store.getAllResults();\n  console.log('Total test results:', allResults.length);\n  if (allResults.length > 0) {\n    console.log('First result name:', allResults[0].name);\n  }\n\n  // Get the latest results, useful for history tracking\n  const latestResults = await store.getLatestResults();\n  console.log('Latest results per historyId:', Object.keys(latestResults).length);\n\n  // Fetch defined categories\n  const categories = await store.getCategories();\n  console.log('Categories loaded:', categories);\n\n  // Example of writing environment info (requires overwrite: true in fromDirectory if directory exists)\n  const writeStore = await fromDirectory('allure-results-output', { overwrite: true });\n  await writeStore.writeEnvironmentInfo({\n    NODE_ENV: process.env.NODE_ENV ?? 'development',\n    BUILD_ID: process.env.BUILD_ID ?? 'local-build'\n  });\n  console.log('Environment info written to allure-results-output');\n})();","lang":"typescript","description":"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."},"warnings":[{"fix":"Monitor GitHub repository for updates and breaking changes. Consider this for non-critical parts of your infrastructure initially.","message":"The 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.","severity":"gotcha","affected_versions":">=1.0.0"},{"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`).","message":"This 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.","severity":"gotcha","affected_versions":">=1.0.0"},{"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.","message":"When 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.","severity":"gotcha","affected_versions":">=1.0.0"},{"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.","message":"Version 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.","severity":"breaking","affected_versions":"<=1.1.0"}],"env_vars":null,"last_verified":"2026-04-19T00:00:00.000Z","next_check":"2026-07-18T00:00:00.000Z","problems":[{"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`).","cause":"Attempting to use CommonJS `require()` syntax in a module that is ESM-only or within an ESM context.","error":"TypeError: require is not a function"},{"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.","cause":"The specified `allure-results` directory does not exist at the given path when calling `fromDirectory`.","error":"ENOENT: no such file or directory, scandir 'allure-results'"},{"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`.","cause":"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`).","error":"TypeError: store.writeEnvironmentInfo is not a function"}],"ecosystem":"npm","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null,"pypi_latest":null}