@allurereport/plugin-api 3.14.3 → 3.15.0
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 +3 -2
- package/dist/plugin.d.ts +7 -4
- package/dist/qualityGate.d.ts +3 -1
- package/dist/store.d.ts +3 -2
- package/dist/store.js +1 -1
- package/dist/utils/summary.d.ts +3 -2
- package/dist/utils/summary.js +10 -6
- package/package.json +2 -2
package/dist/config.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { AllureServiceConfig, CategoriesConfig, DefaultLabelsConfig, EnvironmentsConfig, ReportVariables } from "@allurereport/core-api";
|
|
1
|
+
import type { AllureServiceConfig, CategoriesConfig, DefaultLabelsConfig, EnvironmentsConfig, KnownIssuesPathConfig, ReportVariables, KnownIssuesConfig } 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,7 +9,8 @@ export interface Config {
|
|
|
9
9
|
hideLabels?: (string | RegExp)[];
|
|
10
10
|
historyPath?: string;
|
|
11
11
|
historyLimit?: number;
|
|
12
|
-
knownIssuesPath?:
|
|
12
|
+
knownIssuesPath?: KnownIssuesPathConfig;
|
|
13
|
+
knownIssues?: KnownIssuesConfig;
|
|
13
14
|
defaultLabels?: DefaultLabelsConfig;
|
|
14
15
|
dump?: string;
|
|
15
16
|
environment?: string;
|
package/dist/plugin.d.ts
CHANGED
|
@@ -34,7 +34,10 @@ export interface PluginContext {
|
|
|
34
34
|
categories?: CategoryDefinition[];
|
|
35
35
|
history?: AllureHistory;
|
|
36
36
|
}
|
|
37
|
-
export type
|
|
37
|
+
export type TestResultSummary = Pick<TestResult, "id" | "name" | "duration" | "status">;
|
|
38
|
+
export interface TestResultRegistry {
|
|
39
|
+
byId: Record<string, TestResultSummary>;
|
|
40
|
+
}
|
|
38
41
|
export type SummaryCheckResult = Pick<AllureCheckResult, "id" | "name" | "status">;
|
|
39
42
|
export type { GlobalAttachmentLink } from "@allurereport/core-api";
|
|
40
43
|
export interface PluginSummary {
|
|
@@ -48,9 +51,9 @@ export interface PluginSummary {
|
|
|
48
51
|
duration: number;
|
|
49
52
|
plugin?: string;
|
|
50
53
|
pluginId?: string;
|
|
51
|
-
newTests?:
|
|
52
|
-
flakyTests?:
|
|
53
|
-
retryTests?:
|
|
54
|
+
newTests?: string[];
|
|
55
|
+
flakyTests?: string[];
|
|
56
|
+
retryTests?: string[];
|
|
54
57
|
checks?: SummaryCheckResult[];
|
|
55
58
|
createdAt?: number;
|
|
56
59
|
meta?: Record<string, any>;
|
package/dist/qualityGate.d.ts
CHANGED
|
@@ -6,6 +6,7 @@ export type QualityGateValidationResult = {
|
|
|
6
6
|
rule: string;
|
|
7
7
|
message: string;
|
|
8
8
|
environment?: string;
|
|
9
|
+
testResults: string[];
|
|
9
10
|
};
|
|
10
11
|
export type QualityGateRules = Record<string, any> & {
|
|
11
12
|
id?: string;
|
|
@@ -15,10 +16,11 @@ export type QualityGateRules = Record<string, any> & {
|
|
|
15
16
|
export type QualityGateRuleResult = {
|
|
16
17
|
success: boolean;
|
|
17
18
|
actual: any;
|
|
19
|
+
testResults: string[];
|
|
18
20
|
};
|
|
19
21
|
export interface QualityGateRuleState<T> {
|
|
20
22
|
getResult(): T | undefined;
|
|
21
|
-
setResult(value: T): void;
|
|
23
|
+
setResult(value: T, testResults: QualityGateRuleResult["testResults"]): void;
|
|
22
24
|
}
|
|
23
25
|
export type QualityGateRule<T = any, K = T> = {
|
|
24
26
|
rule: string;
|
package/dist/store.d.ts
CHANGED
|
@@ -47,6 +47,7 @@ export interface AllureStore {
|
|
|
47
47
|
fixturesByTrId: (trId: string) => Promise<TestFixtureResult[]>;
|
|
48
48
|
relatedByTestResultIds: (trIds: readonly string[]) => Promise<TestResultRelatedData>;
|
|
49
49
|
failedTestResults: () => Promise<TestResult[]>;
|
|
50
|
+
blockingFailedTestResults: () => Promise<TestResult[]>;
|
|
50
51
|
unknownFailedTestResults: () => Promise<TestResult[]>;
|
|
51
52
|
testResultsByLabel: (labelName: string) => Promise<{
|
|
52
53
|
_: TestResult[];
|
|
@@ -76,13 +77,13 @@ export interface AllureStoreDump {
|
|
|
76
77
|
fixtures: Record<string, TestFixtureResult>;
|
|
77
78
|
environments: Array<string | EnvironmentIdentity>;
|
|
78
79
|
reportVariables: ReportVariables;
|
|
80
|
+
knownIssues: Record<string, KnownTestFailure>;
|
|
79
81
|
qualityGateResults: QualityGateValidationResult[];
|
|
80
82
|
indexAttachmentByTestResult: Record<string, string[]>;
|
|
81
83
|
indexTestResultByHistoryId: Record<string, string[]>;
|
|
82
84
|
indexTestResultByTestCase: Record<string, string[]>;
|
|
83
85
|
indexAttachmentByFixture: Record<string, string[]>;
|
|
84
86
|
indexFixturesByTestResult: Record<string, string[]>;
|
|
85
|
-
indexKnownByHistoryId: Record<string, KnownTestFailure[]>;
|
|
86
87
|
testResultIdsIngestOrder: string[];
|
|
87
88
|
}
|
|
88
89
|
export declare enum AllureStoreDumpFiles {
|
|
@@ -95,12 +96,12 @@ export declare enum AllureStoreDumpFiles {
|
|
|
95
96
|
CheckResults = "check-results.json",
|
|
96
97
|
Environments = "environments.json",
|
|
97
98
|
ReportVariables = "report-variables.json",
|
|
99
|
+
KnownIssues = "known-issues.json",
|
|
98
100
|
IndexAttachmentsByTestResults = "index-attachments-by-test-results.json",
|
|
99
101
|
IndexTestResultsByHistoryId = "index-test-results-by-history-id.json",
|
|
100
102
|
IndexTestResultsByTestCase = "index-test-results-by-test-case.json",
|
|
101
103
|
IndexAttachmentsByFixture = "index-attachments-by-fixture.json",
|
|
102
104
|
IndexFixturesByTestResult = "index-fixtures-by-test-result.json",
|
|
103
|
-
IndexKnownByHistoryId = "index-known-by-history-id.json",
|
|
104
105
|
QualityGateResults = "quality-gate-results.json",
|
|
105
106
|
TestResultIngestOrder = "test-result-ingest-order.json"
|
|
106
107
|
}
|
package/dist/store.js
CHANGED
|
@@ -9,12 +9,12 @@ 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
13
|
AllureStoreDumpFiles["IndexAttachmentsByTestResults"] = "index-attachments-by-test-results.json";
|
|
13
14
|
AllureStoreDumpFiles["IndexTestResultsByHistoryId"] = "index-test-results-by-history-id.json";
|
|
14
15
|
AllureStoreDumpFiles["IndexTestResultsByTestCase"] = "index-test-results-by-test-case.json";
|
|
15
16
|
AllureStoreDumpFiles["IndexAttachmentsByFixture"] = "index-attachments-by-fixture.json";
|
|
16
17
|
AllureStoreDumpFiles["IndexFixturesByTestResult"] = "index-fixtures-by-test-result.json";
|
|
17
|
-
AllureStoreDumpFiles["IndexKnownByHistoryId"] = "index-known-by-history-id.json";
|
|
18
18
|
AllureStoreDumpFiles["QualityGateResults"] = "quality-gate-results.json";
|
|
19
19
|
AllureStoreDumpFiles["TestResultIngestOrder"] = "test-result-ingest-order.json";
|
|
20
20
|
})(AllureStoreDumpFiles || (AllureStoreDumpFiles = {}));
|
package/dist/utils/summary.d.ts
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { AllureCheckResult, type AllureHistory, type CiDescriptor, type TestResult } from "@allurereport/core-api";
|
|
2
|
-
import type { PluginSummary, SummaryCheckResult,
|
|
2
|
+
import type { PluginSummary, SummaryCheckResult, TestResultRegistry, TestResultSummary } from "../plugin.js";
|
|
3
3
|
import type { AllureStore } from "../store.js";
|
|
4
|
-
export declare const
|
|
4
|
+
export declare const convertToTestResultSummary: (tr: TestResult) => TestResultSummary;
|
|
5
|
+
export declare const createTestResultRegistry: (testResults: TestResult[]) => TestResultRegistry;
|
|
5
6
|
export declare const convertToSummaryCheckResult: (check: AllureCheckResult) => SummaryCheckResult;
|
|
6
7
|
export declare const createPluginSummary: (params: {
|
|
7
8
|
filter?: (testResult: TestResult) => boolean;
|
package/dist/utils/summary.js
CHANGED
|
@@ -1,9 +1,12 @@
|
|
|
1
1
|
import { getWorstStatus, } from "@allurereport/core-api";
|
|
2
|
-
export const
|
|
2
|
+
export const convertToTestResultSummary = (tr) => ({
|
|
3
3
|
id: tr.id,
|
|
4
4
|
name: tr.name,
|
|
5
|
-
status: tr.status,
|
|
6
5
|
duration: tr.duration,
|
|
6
|
+
status: tr.status,
|
|
7
|
+
});
|
|
8
|
+
export const createTestResultRegistry = (testResults) => ({
|
|
9
|
+
byId: Object.fromEntries(testResults.map((testResult) => [testResult.id, convertToTestResultSummary(testResult)])),
|
|
7
10
|
});
|
|
8
11
|
export const convertToSummaryCheckResult = (check) => ({
|
|
9
12
|
id: check.id,
|
|
@@ -16,7 +19,8 @@ export const createPluginSummary = async (params) => {
|
|
|
16
19
|
const allTrs = await store.allTestResults({ filter });
|
|
17
20
|
const mainBranchHistory = (await history?.readHistory?.({ branch: "" })) ?? [];
|
|
18
21
|
const newTrs = await store.allNewTestResults(filter, mainBranchHistory);
|
|
19
|
-
const
|
|
22
|
+
const retryFlags = await Promise.all(allTrs.map(async (tr) => (await store.retriesByTr(tr)).length > 0));
|
|
23
|
+
const retryTrs = allTrs.filter((_, index) => retryFlags[index]);
|
|
20
24
|
const flakyTrs = allTrs.filter((tr) => !!tr?.flaky);
|
|
21
25
|
const duration = allTrs.reduce((acc, { duration: trDuration = 0 }) => acc + trDuration, 0);
|
|
22
26
|
const worstStatus = getWorstStatus(allTrs.map(({ status }) => status));
|
|
@@ -24,9 +28,9 @@ export const createPluginSummary = async (params) => {
|
|
|
24
28
|
return {
|
|
25
29
|
stats: await store.testsStatistic(filter),
|
|
26
30
|
status: worstStatus ?? "passed",
|
|
27
|
-
newTests: newTrs.map(
|
|
28
|
-
flakyTests: flakyTrs.map(
|
|
29
|
-
retryTests: retryTrs.map(
|
|
31
|
+
newTests: newTrs.map(({ id }) => id),
|
|
32
|
+
flakyTests: flakyTrs.map(({ id }) => id),
|
|
33
|
+
retryTests: retryTrs.map(({ id }) => id),
|
|
30
34
|
checks: allChecks.map(convertToSummaryCheckResult),
|
|
31
35
|
name,
|
|
32
36
|
duration,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@allurereport/plugin-api",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.15.0",
|
|
4
4
|
"description": "Allure Plugin API",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"allure"
|
|
@@ -26,7 +26,7 @@
|
|
|
26
26
|
"lint:fix": "oxlint --import-plugin --fix src test features stories"
|
|
27
27
|
},
|
|
28
28
|
"dependencies": {
|
|
29
|
-
"@allurereport/core-api": "3.
|
|
29
|
+
"@allurereport/core-api": "3.15.0"
|
|
30
30
|
},
|
|
31
31
|
"devDependencies": {
|
|
32
32
|
"@types/node": "^20",
|