@allurereport/core 3.0.0-beta.9 → 3.0.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/api.d.ts +23 -13
- package/dist/config.d.ts +14 -8
- package/dist/config.js +90 -20
- package/dist/history.d.ts +8 -3
- package/dist/history.js +35 -20
- package/dist/index.d.ts +4 -2
- package/dist/index.js +4 -2
- package/dist/plugin.d.ts +6 -5
- package/dist/plugin.js +9 -3
- package/dist/qualityGate/index.d.ts +2 -0
- package/dist/qualityGate/index.js +2 -0
- package/dist/qualityGate/qualityGate.d.ts +21 -0
- package/dist/qualityGate/qualityGate.js +103 -0
- package/dist/qualityGate/rules.d.ts +6 -0
- package/dist/qualityGate/rules.js +55 -0
- package/dist/report.d.ts +19 -4
- package/dist/report.js +432 -55
- package/dist/store/convert.js +39 -11
- package/dist/store/store.d.ts +35 -10
- package/dist/store/store.js +446 -55
- package/dist/utils/event.d.ts +38 -9
- package/dist/utils/event.js +101 -25
- package/dist/utils/flaky.d.ts +2 -0
- package/dist/utils/flaky.js +12 -0
- package/dist/utils/new.d.ts +6 -0
- package/dist/utils/new.js +23 -0
- package/package.json +34 -19
- package/dist/qualityGate.d.ts +0 -25
- package/dist/qualityGate.js +0 -116
package/dist/store/convert.js
CHANGED
|
@@ -16,9 +16,10 @@ export const testFixtureResultRawToState = (stateData, raw, context) => {
|
|
|
16
16
|
error: {
|
|
17
17
|
message: raw.message,
|
|
18
18
|
trace: raw.trace,
|
|
19
|
+
...(raw.actual && raw.expected ? { expected: raw.expected, actual: raw.actual } : {}),
|
|
19
20
|
},
|
|
20
21
|
...processTimings(raw),
|
|
21
|
-
steps: convertSteps(stateData, raw.steps),
|
|
22
|
+
steps: convertSteps(stateData, raw.steps).convertedSteps,
|
|
22
23
|
sourceMetadata: {
|
|
23
24
|
readerId: context.readerId,
|
|
24
25
|
metadata: context.metadata ?? {},
|
|
@@ -42,6 +43,7 @@ export const testResultRawToState = (stateData, raw, context) => {
|
|
|
42
43
|
error: {
|
|
43
44
|
message: raw.message,
|
|
44
45
|
trace: raw.trace,
|
|
46
|
+
...(raw.actual && raw.expected ? { expected: raw.expected, actual: raw.actual } : {}),
|
|
45
47
|
},
|
|
46
48
|
...processTimings(raw),
|
|
47
49
|
description: raw.description,
|
|
@@ -55,7 +57,7 @@ export const testResultRawToState = (stateData, raw, context) => {
|
|
|
55
57
|
known: raw.known ?? false,
|
|
56
58
|
hidden: false,
|
|
57
59
|
labels,
|
|
58
|
-
steps: convertSteps(stateData, raw.steps),
|
|
60
|
+
steps: convertSteps(stateData, raw.steps).convertedSteps,
|
|
59
61
|
parameters,
|
|
60
62
|
links: convertLinks(raw.links),
|
|
61
63
|
hostId,
|
|
@@ -64,6 +66,7 @@ export const testResultRawToState = (stateData, raw, context) => {
|
|
|
64
66
|
readerId: context.readerId,
|
|
65
67
|
metadata: context.metadata ?? {},
|
|
66
68
|
},
|
|
69
|
+
titlePath: raw.titlePath ?? [],
|
|
67
70
|
};
|
|
68
71
|
};
|
|
69
72
|
const processTestCase = ({ testCases }, raw) => {
|
|
@@ -170,21 +173,46 @@ const convertLabel = (label) => {
|
|
|
170
173
|
value: label.value,
|
|
171
174
|
};
|
|
172
175
|
};
|
|
173
|
-
const convertSteps = (stateData, steps) =>
|
|
176
|
+
const convertSteps = (stateData, steps) => {
|
|
177
|
+
const convertedStepData = steps?.filter(notNull)?.map((step) => convertStep(stateData, step)) ?? [];
|
|
178
|
+
return {
|
|
179
|
+
convertedSteps: convertedStepData.map(({ convertedStep }) => convertedStep),
|
|
180
|
+
messages: new Set(convertedStepData.reduce((acc, { messages }) => {
|
|
181
|
+
if (messages) {
|
|
182
|
+
acc.push(...messages);
|
|
183
|
+
}
|
|
184
|
+
return acc;
|
|
185
|
+
}, [])),
|
|
186
|
+
};
|
|
187
|
+
};
|
|
174
188
|
const convertStep = (stateData, step) => {
|
|
175
189
|
if (step.type === "step") {
|
|
190
|
+
const { message } = step;
|
|
191
|
+
const { convertedSteps: subSteps, messages } = convertSteps(stateData, step.steps);
|
|
192
|
+
const hasSimilarErrorInSubSteps = !!message && messages.has(message);
|
|
193
|
+
if (message && !hasSimilarErrorInSubSteps) {
|
|
194
|
+
messages.add(message);
|
|
195
|
+
}
|
|
176
196
|
return {
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
197
|
+
convertedStep: {
|
|
198
|
+
stepId: md5(`${step.name}${step.start}`),
|
|
199
|
+
name: step.name ?? __unknown,
|
|
200
|
+
status: step.status ?? defaultStatus,
|
|
201
|
+
steps: subSteps,
|
|
202
|
+
parameters: convertParameters(step.parameters),
|
|
203
|
+
...processTimings(step),
|
|
204
|
+
type: "step",
|
|
205
|
+
message,
|
|
206
|
+
trace: step.trace,
|
|
207
|
+
hasSimilarErrorInSubSteps,
|
|
208
|
+
},
|
|
209
|
+
messages,
|
|
184
210
|
};
|
|
185
211
|
}
|
|
186
212
|
return {
|
|
187
|
-
|
|
213
|
+
convertedStep: {
|
|
214
|
+
...processAttachmentLink(stateData, step),
|
|
215
|
+
},
|
|
188
216
|
};
|
|
189
217
|
};
|
|
190
218
|
const convertParameters = (parameters) => parameters
|
package/dist/store/store.d.ts
CHANGED
|
@@ -1,30 +1,40 @@
|
|
|
1
|
-
import type
|
|
2
|
-
import type
|
|
1
|
+
import { type AllureHistory, type AttachmentLink, type DefaultLabelsConfig, type EnvironmentsConfig, type HistoryDataPoint, type HistoryTestResult, type KnownTestFailure, type ReportVariables, type Statistic, type TestCase, type TestEnvGroup, type TestError, type TestFixtureResult, type TestResult } from "@allurereport/core-api";
|
|
2
|
+
import { type AllureStore, type AllureStoreDump, type ExitCode, type QualityGateValidationResult, type RealtimeEventsDispatcher, type RealtimeSubscriber, type ResultFile, type TestResultFilter } from "@allurereport/plugin-api";
|
|
3
3
|
import type { RawFixtureResult, RawMetadata, RawTestResult, ReaderContext, ResultsVisitor } from "@allurereport/reader-api";
|
|
4
|
-
|
|
5
|
-
|
|
4
|
+
export declare const mapToObject: <K extends string | number | symbol, T = any>(map: Map<K, T>) => Record<K, T>;
|
|
5
|
+
export declare const updateMapWithRecord: <K extends string | number | symbol, T = any>(map: Map<K, T>, record: Record<K, T>) => Map<K, T>;
|
|
6
6
|
export declare class DefaultAllureStore implements AllureStore, ResultsVisitor {
|
|
7
7
|
#private;
|
|
8
8
|
readonly indexTestResultByTestCase: Map<string, TestResult[]>;
|
|
9
|
-
readonly
|
|
9
|
+
readonly indexLatestEnvTestResultByHistoryId: Map<string, Map<string, TestResult>>;
|
|
10
10
|
readonly indexTestResultByHistoryId: Map<string, TestResult[]>;
|
|
11
11
|
readonly indexAttachmentByTestResult: Map<string, AttachmentLink[]>;
|
|
12
12
|
readonly indexAttachmentByFixture: Map<string, AttachmentLink[]>;
|
|
13
13
|
readonly indexFixturesByTestResult: Map<string, TestFixtureResult[]>;
|
|
14
14
|
readonly indexKnownByHistoryId: Map<string, KnownTestFailure[]>;
|
|
15
15
|
constructor(params?: {
|
|
16
|
-
history?:
|
|
16
|
+
history?: AllureHistory;
|
|
17
17
|
known?: KnownTestFailure[];
|
|
18
|
-
|
|
18
|
+
realtimeDispatcher?: RealtimeEventsDispatcher;
|
|
19
|
+
realtimeSubscriber?: RealtimeSubscriber;
|
|
19
20
|
defaultLabels?: DefaultLabelsConfig;
|
|
21
|
+
environment?: string;
|
|
22
|
+
environmentsConfig?: EnvironmentsConfig;
|
|
23
|
+
reportVariables?: ReportVariables;
|
|
20
24
|
});
|
|
25
|
+
readHistory(): Promise<HistoryDataPoint[]>;
|
|
26
|
+
appendHistory(history: HistoryDataPoint): Promise<void>;
|
|
27
|
+
qualityGateResults(): Promise<QualityGateValidationResult[]>;
|
|
28
|
+
globalExitCode(): Promise<ExitCode | undefined>;
|
|
29
|
+
allGlobalErrors(): Promise<TestError[]>;
|
|
30
|
+
allGlobalAttachments(): Promise<AttachmentLink[]>;
|
|
21
31
|
visitTestResult(raw: RawTestResult, context: ReaderContext): Promise<void>;
|
|
22
32
|
visitTestFixtureResult(result: RawFixtureResult, context: ReaderContext): Promise<void>;
|
|
23
33
|
visitAttachmentFile(resultFile: ResultFile, context: ReaderContext): Promise<void>;
|
|
24
34
|
visitMetadata(metadata: RawMetadata): Promise<void>;
|
|
25
35
|
allTestCases(): Promise<TestCase[]>;
|
|
26
36
|
allTestResults(options?: {
|
|
27
|
-
includeHidden
|
|
37
|
+
includeHidden?: boolean;
|
|
28
38
|
}): Promise<TestResult[]>;
|
|
29
39
|
allAttachments(options?: {
|
|
30
40
|
includeMissed?: boolean;
|
|
@@ -33,7 +43,9 @@ export declare class DefaultAllureStore implements AllureStore, ResultsVisitor {
|
|
|
33
43
|
allMetadata(): Promise<Record<string, any>>;
|
|
34
44
|
allFixtures(): Promise<TestFixtureResult[]>;
|
|
35
45
|
allHistoryDataPoints(): Promise<HistoryDataPoint[]>;
|
|
46
|
+
allHistoryDataPointsByEnvironment(environment: string): Promise<HistoryDataPoint[]>;
|
|
36
47
|
allKnownIssues(): Promise<KnownTestFailure[]>;
|
|
48
|
+
allNewTestResults(): Promise<TestResult[]>;
|
|
37
49
|
testCaseById(tcId: string): Promise<TestCase | undefined>;
|
|
38
50
|
testResultById(trId: string): Promise<TestResult | undefined>;
|
|
39
51
|
attachmentById(attachmentId: string): Promise<AttachmentLink | undefined>;
|
|
@@ -41,8 +53,10 @@ export declare class DefaultAllureStore implements AllureStore, ResultsVisitor {
|
|
|
41
53
|
metadataByKey<T>(key: string): Promise<T | undefined>;
|
|
42
54
|
testResultsByTcId(tcId: string): Promise<TestResult[]>;
|
|
43
55
|
attachmentsByTrId(trId: string): Promise<AttachmentLink[]>;
|
|
56
|
+
retriesByTr(tr: TestResult): Promise<TestResult[]>;
|
|
44
57
|
retriesByTrId(trId: string): Promise<TestResult[]>;
|
|
45
|
-
|
|
58
|
+
historyByTr(tr: TestResult): Promise<HistoryTestResult[] | undefined>;
|
|
59
|
+
historyByTrId(trId: string): Promise<HistoryTestResult[] | undefined>;
|
|
46
60
|
fixturesByTrId(trId: string): Promise<TestFixtureResult[]>;
|
|
47
61
|
failedTestResults(): Promise<TestResult[]>;
|
|
48
62
|
unknownFailedTestResults(): Promise<TestResult[]>;
|
|
@@ -50,5 +64,16 @@ export declare class DefaultAllureStore implements AllureStore, ResultsVisitor {
|
|
|
50
64
|
[x: string]: TestResult[];
|
|
51
65
|
_: TestResult[];
|
|
52
66
|
}>;
|
|
53
|
-
testsStatistic(): Promise<Statistic>;
|
|
67
|
+
testsStatistic(filter?: TestResultFilter): Promise<Statistic>;
|
|
68
|
+
allEnvironments(): Promise<string[]>;
|
|
69
|
+
testResultsByEnvironment(env: string, options?: {
|
|
70
|
+
includeHidden: boolean;
|
|
71
|
+
}): Promise<TestResult[]>;
|
|
72
|
+
allTestEnvGroups(): Promise<TestEnvGroup[]>;
|
|
73
|
+
allVariables(): Promise<ReportVariables>;
|
|
74
|
+
envVariables(env: string): Promise<{
|
|
75
|
+
[x: string]: string;
|
|
76
|
+
}>;
|
|
77
|
+
dumpState(): AllureStoreDump;
|
|
78
|
+
restoreState(stateDump: AllureStoreDump, attachmentsContents?: Record<string, ResultFile>): Promise<void>;
|
|
54
79
|
}
|