@allurereport/plugin-api 3.16.0 → 3.16.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/config.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import type { AllureServiceConfig, CategoriesConfig, DefaultLabelsConfig, EnvironmentsConfig, KnownIssuesPathConfig, ReportVariables, KnownIssuesConfig } from "@allurereport/core-api";
1
+ import type { AllureServiceConfig, CategoriesConfig, DefaultLabelsConfig, EnvironmentsConfig, ReportVariables, ResolutionsConfig } from "@allurereport/core-api";
2
2
  import type { PluginDescriptor } from "./plugin.js";
3
3
  import type { QualityGateConfig } from "./qualityGate.js";
4
4
  export interface Config {
@@ -9,8 +9,7 @@ export interface Config {
9
9
  hideLabels?: (string | RegExp)[];
10
10
  historyPath?: string;
11
11
  historyLimit?: number;
12
- knownIssuesPath?: KnownIssuesPathConfig;
13
- knownIssues?: KnownIssuesConfig;
12
+ resolutions?: ResolutionsConfig;
14
13
  defaultLabels?: DefaultLabelsConfig;
15
14
  dump?: string;
16
15
  environment?: string;
package/dist/index.d.ts CHANGED
@@ -1,6 +1,7 @@
1
1
  export * from "./config.js";
2
2
  export type * from "./plugin.js";
3
3
  export type * from "./qualityGate.js";
4
+ export type * from "./report.js";
4
5
  export * from "./store.js";
5
6
  export type * from "./resultFile.js";
6
7
  export * from "./utils/misc.js";
@@ -1,4 +1,4 @@
1
- import type { KnownTestFailure, TestResult } from "@allurereport/core-api";
1
+ import type { TestResult } from "@allurereport/core-api";
2
2
  export type QualityGateValidationResult = {
3
3
  success: boolean;
4
4
  expected: any;
@@ -31,7 +31,6 @@ export type QualityGateRule<T = any, K = T> = {
31
31
  validate: (payload: {
32
32
  expected: T;
33
33
  trs: TestResult[];
34
- knownIssues: KnownTestFailure[];
35
34
  state: QualityGateRuleState<K>;
36
35
  environment?: string;
37
36
  }) => Promise<QualityGateRuleResult>;
@@ -0,0 +1,124 @@
1
+ import type { AttachmentTestStepResult, CiDescriptor, DefaultTreeGroup, HistoryTestResult, TestFixtureResult, TestResult, TestStatus, TestStepResult, TreeData, WithChildren } from "@allurereport/core-api";
2
+ import type { QualityGateValidationResult } from "./qualityGate.js";
3
+ export type Layout = "base" | "split";
4
+ export type StepTreeExpansion = "collapsed" | "expand_failed_only" | "expanded";
5
+ export type ReportRunSummary = {
6
+ start: number;
7
+ stop: number;
8
+ duration: number;
9
+ };
10
+ export type ReportExecutorInfo = {
11
+ name?: string;
12
+ type?: string;
13
+ url?: string;
14
+ buildOrder?: number;
15
+ buildName?: string;
16
+ buildUrl?: string;
17
+ reportName?: string;
18
+ reportUrl?: string;
19
+ };
20
+ export type ReportOptions = {
21
+ id?: string;
22
+ allureVersion: string;
23
+ reportName?: string;
24
+ logo?: string;
25
+ theme?: "light" | "dark" | "auto";
26
+ groupBy?: string[];
27
+ reportLanguage?: string;
28
+ createdAt: number;
29
+ reportUuid: string;
30
+ layout?: Layout;
31
+ defaultSection?: string;
32
+ sections?: string[];
33
+ cacheKey?: string;
34
+ ci?: CiDescriptor;
35
+ executor?: ReportExecutorInfo;
36
+ runSummary?: ReportRunSummary;
37
+ stepTreeExpansion?: StepTreeExpansion;
38
+ defaultSortBy?: string;
39
+ };
40
+ export type ReportFixtureResult = Omit<TestFixtureResult, "testResultIds" | "start" | "stop" | "sourceMetadata" | "steps"> & {
41
+ steps: ReportTestStepResult[];
42
+ };
43
+ export type ReportStatus = TestStatus | "total";
44
+ export type ReportTestStepResult = TestStepResult;
45
+ type ReportBreadcrumbItem = string[] | string[][];
46
+ export interface ReportCategory {
47
+ id?: string;
48
+ name: string;
49
+ grouping?: {
50
+ key: string;
51
+ value?: string;
52
+ name?: string;
53
+ }[];
54
+ description?: string;
55
+ descriptionHtml?: string;
56
+ messageRegex?: string;
57
+ traceRegex?: string;
58
+ matchedStatuses?: TestStatus[];
59
+ flaky?: boolean;
60
+ }
61
+ export type ReportTestResult = Omit<TestResult, "runSelector" | "sourceMetadata" | "expectedResult" | "expectedResultHtml" | "precondition" | "preconditionHtml" | "steps" | "categories" | "environment"> & {
62
+ isRetry: boolean;
63
+ setup: ReportFixtureResult[];
64
+ teardown: ReportFixtureResult[];
65
+ steps: ReportTestStepResult[];
66
+ history: HistoryTestResult[];
67
+ retries?: TestResult[];
68
+ retriesCount?: number;
69
+ groupedLabels: Record<string, string[]>;
70
+ attachments?: AttachmentTestStepResult[];
71
+ breadcrumbs: ReportBreadcrumbItem[];
72
+ order?: number;
73
+ groupOrder?: number;
74
+ retry: boolean;
75
+ categories?: ReportCategory[];
76
+ environment?: string | "default";
77
+ tooltips?: Record<string, string>;
78
+ time?: Record<string, string[]>;
79
+ extra?: {
80
+ severity: string;
81
+ };
82
+ };
83
+ export type ReportTreeLeaf = Pick<ReportTestResult, "duration" | "name" | "start" | "status" | "groupOrder" | "flaky" | "transition" | "retry" | "retriesCount"> & {
84
+ nodeId: string;
85
+ id?: string;
86
+ transitionTooltip?: string;
87
+ tooltips?: Record<string, string>;
88
+ tags?: string[];
89
+ categories?: string[];
90
+ };
91
+ export type ReportTreeGroup = WithChildren & DefaultTreeGroup & {
92
+ nodeId: string;
93
+ };
94
+ export type ReportTree = TreeData<ReportTreeLeaf, ReportTreeGroup>;
95
+ export type ReportQualityGateValidationResult = QualityGateValidationResult & {
96
+ testResultsTree?: ReportTree;
97
+ };
98
+ export type ReportQualityGateResults = Record<string, ReportQualityGateValidationResult[]>;
99
+ export type ReportSearchDocument = {
100
+ id: string;
101
+ nodeId: string;
102
+ name: string;
103
+ fullName?: string;
104
+ historyId?: string;
105
+ labels?: string;
106
+ owner?: string;
107
+ tags?: string;
108
+ parameters?: string;
109
+ categories?: string;
110
+ statusMessage?: string;
111
+ links?: string;
112
+ };
113
+ export type ReportRecursiveTree = DefaultTreeGroup & {
114
+ nodeId: string;
115
+ leaves: ReportTreeLeaf[];
116
+ trees: ReportRecursiveTree[];
117
+ duration?: number;
118
+ groupOrder?: number;
119
+ minStart?: number;
120
+ };
121
+ export type ReportTestResultGroup = Pick<ReportTestResult, "name" | "fullName" | "groupOrder"> & {
122
+ testResults: ReportTestResult[];
123
+ };
124
+ export {};
package/dist/report.js ADDED
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,9 @@
1
+ import type { ReportFiles } from "./plugin.js";
2
+ export type ReportStaticManifest = Record<string, string>;
3
+ export type ReportStaticAssets = {
4
+ manifest: ReportStaticManifest;
5
+ files: ReadonlyMap<string, Buffer>;
6
+ };
7
+ export declare const readReportStaticAssets: (archive: string | URL) => Promise<ReportStaticAssets>;
8
+ export declare const getReportStaticAsset: (assets: ReportStaticAssets, fileName: string) => Buffer;
9
+ export declare const copyReportStaticAssets: (assets: ReportStaticAssets, reportFiles: ReportFiles) => Promise<void>;
@@ -0,0 +1,105 @@
1
+ import { createReadStream } from "node:fs";
2
+ import { posix } from "node:path";
3
+ import { pipeline } from "node:stream/promises";
4
+ import { extract } from "tar-stream";
5
+ const validateEntryName = (name) => {
6
+ if (!name ||
7
+ name.includes("\0") ||
8
+ name.includes("\\") ||
9
+ posix.isAbsolute(name) ||
10
+ posix.normalize(name) !== name ||
11
+ name === ".." ||
12
+ name.startsWith("../")) {
13
+ throw new Error(`Unsafe report static archive entry: ${JSON.stringify(name)}`);
14
+ }
15
+ };
16
+ const parseManifest = (content) => {
17
+ let manifest;
18
+ try {
19
+ manifest = JSON.parse(content.toString("utf8"));
20
+ }
21
+ catch (error) {
22
+ throw new Error("The report static archive contains an invalid manifest.json", { cause: error });
23
+ }
24
+ if (!manifest || typeof manifest !== "object" || Array.isArray(manifest)) {
25
+ throw new Error("The report static archive manifest must be an object");
26
+ }
27
+ for (const [key, value] of Object.entries(manifest)) {
28
+ if (!key || typeof value !== "string") {
29
+ throw new Error("The report static archive manifest must map non-empty keys to file names");
30
+ }
31
+ validateEntryName(value);
32
+ }
33
+ return manifest;
34
+ };
35
+ export const readReportStaticAssets = async (archive) => {
36
+ const files = new Map();
37
+ const archiveExtractor = extract();
38
+ let archiveError;
39
+ archiveExtractor.on("entry", (header, stream, next) => {
40
+ const skipEntry = (error) => {
41
+ archiveError ?? (archiveError = error);
42
+ stream.on("end", next);
43
+ stream.resume();
44
+ };
45
+ if (header.type === "directory") {
46
+ stream.on("end", next);
47
+ stream.resume();
48
+ return;
49
+ }
50
+ if (header.type !== "file") {
51
+ skipEntry(new Error(`Unsupported report static archive entry type: ${header.type}`));
52
+ return;
53
+ }
54
+ try {
55
+ validateEntryName(header.name);
56
+ if (files.has(header.name)) {
57
+ throw new Error(`Duplicate report static archive entry: ${header.name}`);
58
+ }
59
+ }
60
+ catch (error) {
61
+ skipEntry(error instanceof Error ? error : new Error(String(error)));
62
+ return;
63
+ }
64
+ const chunks = [];
65
+ stream.on("data", (chunk) => {
66
+ chunks.push(Buffer.isBuffer(chunk) ? chunk : Buffer.from(chunk));
67
+ });
68
+ stream.on("error", (error) => archiveExtractor.destroy(error));
69
+ stream.on("end", () => {
70
+ files.set(header.name, Buffer.concat(chunks));
71
+ next();
72
+ });
73
+ });
74
+ await pipeline(createReadStream(archive), archiveExtractor);
75
+ if (archiveError) {
76
+ throw archiveError;
77
+ }
78
+ const manifestContent = files.get("manifest.json");
79
+ if (!manifestContent) {
80
+ throw new Error("The report static archive does not contain manifest.json");
81
+ }
82
+ files.delete("manifest.json");
83
+ const manifest = parseManifest(manifestContent);
84
+ if (!manifest["main.js"]) {
85
+ throw new Error('The report static archive manifest does not contain "main.js"');
86
+ }
87
+ for (const fileName of Object.values(manifest)) {
88
+ if (!files.has(fileName)) {
89
+ throw new Error(`The report static archive does not contain manifest asset: ${fileName}`);
90
+ }
91
+ }
92
+ return { manifest, files };
93
+ };
94
+ export const getReportStaticAsset = (assets, fileName) => {
95
+ const content = assets.files.get(fileName);
96
+ if (!content) {
97
+ throw new Error(`The report static archive does not contain asset: ${fileName}`);
98
+ }
99
+ return content;
100
+ };
101
+ export const copyReportStaticAssets = async (assets, reportFiles) => {
102
+ for (const [fileName, content] of assets.files) {
103
+ await reportFiles.addFile(fileName, content);
104
+ }
105
+ };
package/dist/store.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import type { AllureCheckResult, AttachmentLink, EnvironmentIdentity, GlobalAttachmentLink, HistoryDataPoint, HistoryTestResult, KnownTestFailure, ReportVariables, Statistic, TestCase, TestEnvGroup, TestError, TestFixtureResult, TestResult } from "@allurereport/core-api";
1
+ import type { AllureCheckResult, AttachmentLink, EnvironmentIdentity, GlobalAttachmentLink, HistoryDataPoint, HistoryTestResult, ResolutionIssue, ReportVariables, Statistic, TestCase, TestEnvGroup, TestError, TestFixtureResult, TestResult } from "@allurereport/core-api";
2
2
  import type { ExitCode, PluginGlobalError } from "./plugin.js";
3
3
  import type { QualityGateValidationResult } from "./qualityGate.js";
4
4
  import type { ResultFile } from "./resultFile.js";
@@ -21,7 +21,9 @@ export interface AllureStore {
21
21
  allHistoryDataPoints: () => Promise<HistoryDataPoint[]>;
22
22
  allHistoryDataPointsByEnvironment: (environment: string) => Promise<HistoryDataPoint[]>;
23
23
  allHistoryDataPointsByEnvironmentId: (environmentId: string) => Promise<HistoryDataPoint[]>;
24
- allKnownIssues: () => Promise<KnownTestFailure[]>;
24
+ allResolutionIssues: () => Promise<ResolutionIssue[]>;
25
+ resolutionIssueByTestResultId: (trId: string) => Promise<ResolutionIssue | undefined>;
26
+ testResultsByResolutionIssueId: (resolutionIssueId: string) => Promise<TestResult[]>;
25
27
  allNewTestResults: (filter?: TestResultFilter, history?: HistoryDataPoint[]) => Promise<TestResult[]>;
26
28
  addCheckResult: (result: AllureCheckResult) => Promise<void>;
27
29
  allCheckResults: () => Promise<AllureCheckResult[]>;
@@ -77,11 +79,12 @@ export interface AllureStoreDump {
77
79
  fixtures: Record<string, TestFixtureResult>;
78
80
  environments: Array<string | EnvironmentIdentity>;
79
81
  reportVariables: ReportVariables;
80
- knownIssues: Record<string, KnownTestFailure>;
82
+ resolutionIssues: Record<string, ResolutionIssue>;
81
83
  qualityGateResults: QualityGateValidationResult[];
82
84
  indexAttachmentByTestResult: Record<string, string[]>;
83
85
  indexTestResultByHistoryId: Record<string, string[]>;
84
86
  indexTestResultByTestCase: Record<string, string[]>;
87
+ indexTestResultByResolutionIssue: Record<string, string[]>;
85
88
  indexAttachmentByFixture: Record<string, string[]>;
86
89
  indexFixturesByTestResult: Record<string, string[]>;
87
90
  testResultIdsIngestOrder: string[];
@@ -96,10 +99,11 @@ export declare enum AllureStoreDumpFiles {
96
99
  CheckResults = "check-results.json",
97
100
  Environments = "environments.json",
98
101
  ReportVariables = "report-variables.json",
99
- KnownIssues = "known-issues.json",
102
+ ResolutionIssues = "resolution-issues.json",
100
103
  IndexAttachmentsByTestResults = "index-attachments-by-test-results.json",
101
104
  IndexTestResultsByHistoryId = "index-test-results-by-history-id.json",
102
105
  IndexTestResultsByTestCase = "index-test-results-by-test-case.json",
106
+ IndexTestResultsByResolutionIssue = "index-test-results-by-resolution-issue.json",
103
107
  IndexAttachmentsByFixture = "index-attachments-by-fixture.json",
104
108
  IndexFixturesByTestResult = "index-fixtures-by-test-result.json",
105
109
  QualityGateResults = "quality-gate-results.json",
package/dist/store.js CHANGED
@@ -9,10 +9,11 @@ export var AllureStoreDumpFiles;
9
9
  AllureStoreDumpFiles["CheckResults"] = "check-results.json";
10
10
  AllureStoreDumpFiles["Environments"] = "environments.json";
11
11
  AllureStoreDumpFiles["ReportVariables"] = "report-variables.json";
12
- AllureStoreDumpFiles["KnownIssues"] = "known-issues.json";
12
+ AllureStoreDumpFiles["ResolutionIssues"] = "resolution-issues.json";
13
13
  AllureStoreDumpFiles["IndexAttachmentsByTestResults"] = "index-attachments-by-test-results.json";
14
14
  AllureStoreDumpFiles["IndexTestResultsByHistoryId"] = "index-test-results-by-history-id.json";
15
15
  AllureStoreDumpFiles["IndexTestResultsByTestCase"] = "index-test-results-by-test-case.json";
16
+ AllureStoreDumpFiles["IndexTestResultsByResolutionIssue"] = "index-test-results-by-resolution-issue.json";
16
17
  AllureStoreDumpFiles["IndexAttachmentsByFixture"] = "index-attachments-by-fixture.json";
17
18
  AllureStoreDumpFiles["IndexFixturesByTestResult"] = "index-fixtures-by-test-result.json";
18
19
  AllureStoreDumpFiles["QualityGateResults"] = "quality-gate-results.json";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@allurereport/plugin-api",
3
- "version": "3.16.0",
3
+ "version": "3.16.1",
4
4
  "description": "Allure Plugin API",
5
5
  "keywords": [
6
6
  "allure"
@@ -9,14 +9,17 @@
9
9
  "author": "Qameta Software",
10
10
  "repository": "https://github.com/allure-framework/allure3",
11
11
  "files": [
12
- "dist"
12
+ "dist",
13
+ "!dist/packStaticAssets.d.ts",
14
+ "!dist/packStaticAssets.js"
13
15
  ],
14
16
  "type": "module",
15
17
  "main": "./dist/index.js",
16
18
  "module": "./dist/index.js",
17
19
  "types": "./dist/index.d.ts",
18
20
  "exports": {
19
- ".": "./dist/index.js"
21
+ ".": "./dist/index.js",
22
+ "./static-assets": "./dist/staticAssets.js"
20
23
  },
21
24
  "scripts": {
22
25
  "build": "run clean && tsc --project ./tsconfig.json",
@@ -26,10 +29,12 @@
26
29
  "lint:fix": "oxlint --import-plugin --fix src test features stories"
27
30
  },
28
31
  "dependencies": {
29
- "@allurereport/core-api": "3.16.0"
32
+ "@allurereport/core-api": "3.16.1",
33
+ "tar-stream": "3.1.7"
30
34
  },
31
35
  "devDependencies": {
32
36
  "@types/node": "^20",
37
+ "@types/tar-stream": "^3.1.4",
33
38
  "@vitest/runner": "^2",
34
39
  "@vitest/snapshot": "^2.1.9",
35
40
  "allure-js-commons": "^3",