@allurereport/core 3.16.0 → 3.17.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 +4 -4
- package/dist/config.d.ts +2 -1
- package/dist/config.js +14 -10
- package/dist/history.d.ts +2 -2
- package/dist/history.js +12 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +2 -2
- package/dist/qualityGate/qualityGate.d.ts +6 -5
- package/dist/qualityGate/qualityGate.js +5 -3
- package/dist/qualityGate/rules.d.ts +13 -10
- package/dist/qualityGate/rules.js +142 -15
- package/dist/report.d.ts +1 -2
- package/dist/report.js +125 -52
- package/dist/resolutions.d.ts +8 -0
- package/dist/resolutions.js +181 -0
- package/dist/store/convert.js +0 -1
- package/dist/store/store.d.ts +8 -5
- package/dist/store/store.js +110 -38
- package/dist/utils/artifacts.d.ts +14 -0
- package/dist/utils/artifacts.js +35 -0
- package/dist/utils/perf.d.ts +6 -10
- package/dist/utils/perf.js +41 -28
- package/package.json +21 -21
- package/dist/known.d.ts +0 -8
- package/dist/known.js +0 -86
|
@@ -0,0 +1,181 @@
|
|
|
1
|
+
import { mkdir, stat, writeFile } from "node:fs/promises";
|
|
2
|
+
import { dirname, extname, resolve } from "node:path";
|
|
3
|
+
import { isFileNotFoundError } from "./utils/misc.js";
|
|
4
|
+
export const DEFAULT_KNOWN_ISSUES_PATH = "known-issues.json";
|
|
5
|
+
const nonEmpty = (value) => typeof value === "string" && value.trim().length > 0;
|
|
6
|
+
const validateStringList = (value, path, errors) => {
|
|
7
|
+
if (value === undefined) {
|
|
8
|
+
return;
|
|
9
|
+
}
|
|
10
|
+
if (!Array.isArray(value) || value.length === 0 || value.some((entry) => !nonEmpty(entry))) {
|
|
11
|
+
errors.push(`${path} must be a non-empty array of non-empty strings`);
|
|
12
|
+
}
|
|
13
|
+
};
|
|
14
|
+
const placeholderCount = (value) => (typeof value === "string" ? (value.match(/%s/g)?.length ?? 0) : 0);
|
|
15
|
+
const validateLinkTemplate = (type, template, errors) => {
|
|
16
|
+
if (!nonEmpty(type)) {
|
|
17
|
+
errors.push("resolutions.links keys must be non-empty strings");
|
|
18
|
+
}
|
|
19
|
+
if (!nonEmpty(template?.urlTemplate) || placeholderCount(template.urlTemplate) !== 1) {
|
|
20
|
+
errors.push(`resolutions.links.${type}.urlTemplate must contain exactly one %s`);
|
|
21
|
+
}
|
|
22
|
+
if (template?.nameTemplate === undefined) {
|
|
23
|
+
return;
|
|
24
|
+
}
|
|
25
|
+
if (!nonEmpty(template.nameTemplate) || placeholderCount(template.nameTemplate) !== 1) {
|
|
26
|
+
errors.push(`resolutions.links.${type}.nameTemplate must contain exactly one %s`);
|
|
27
|
+
}
|
|
28
|
+
};
|
|
29
|
+
const validateMessageRegexp = (value, path, errors) => {
|
|
30
|
+
if (value === undefined) {
|
|
31
|
+
return;
|
|
32
|
+
}
|
|
33
|
+
try {
|
|
34
|
+
new RegExp(value);
|
|
35
|
+
}
|
|
36
|
+
catch {
|
|
37
|
+
errors.push(`${path}.messageRegexp must be a valid regular expression`);
|
|
38
|
+
}
|
|
39
|
+
};
|
|
40
|
+
const validateMatcher = (matcher, path, errors) => {
|
|
41
|
+
validateStringList(matcher.testCaseId, `${path}.testCaseId`, errors);
|
|
42
|
+
validateStringList(matcher.retryHash, `${path}.retryHash`, errors);
|
|
43
|
+
validateStringList(matcher.environment, `${path}.environment`, errors);
|
|
44
|
+
if (![matcher.messageRegexp, matcher.testCaseId, matcher.retryHash, matcher.environment].some((value) => value !== undefined)) {
|
|
45
|
+
errors.push(`${path} must contain at least one matcher`);
|
|
46
|
+
}
|
|
47
|
+
validateMessageRegexp(matcher.messageRegexp, path, errors);
|
|
48
|
+
};
|
|
49
|
+
const validateIssueUrl = (rule, template, errors) => {
|
|
50
|
+
if (!nonEmpty(template.urlTemplate) || placeholderCount(template.urlTemplate) !== 1) {
|
|
51
|
+
return;
|
|
52
|
+
}
|
|
53
|
+
let url;
|
|
54
|
+
try {
|
|
55
|
+
url = new URL(template.urlTemplate.replace("%s", encodeURIComponent(rule.issue.id)));
|
|
56
|
+
}
|
|
57
|
+
catch {
|
|
58
|
+
errors.push(`resolutions.links.${rule.issue.type}.urlTemplate must resolve to an absolute URL`);
|
|
59
|
+
return;
|
|
60
|
+
}
|
|
61
|
+
if (url.protocol !== "http:" && url.protocol !== "https:") {
|
|
62
|
+
errors.push(`resolutions.links.${rule.issue.type}.urlTemplate must resolve to an HTTP(S) URL`);
|
|
63
|
+
}
|
|
64
|
+
};
|
|
65
|
+
const validateIssueRule = (rule, path, config, issueIds, errors) => {
|
|
66
|
+
if (!nonEmpty(rule.issue?.id) || !nonEmpty(rule.issue?.type)) {
|
|
67
|
+
errors.push(`${path}.issue.id and ${path}.issue.type must be non-empty strings`);
|
|
68
|
+
return;
|
|
69
|
+
}
|
|
70
|
+
if (issueIds.has(rule.issue.id)) {
|
|
71
|
+
errors.push(`${path}.issue.id must be unique`);
|
|
72
|
+
}
|
|
73
|
+
issueIds.add(rule.issue.id);
|
|
74
|
+
const template = config.links?.[rule.issue.type];
|
|
75
|
+
if (!template) {
|
|
76
|
+
errors.push(`${path}.issue.type must reference resolutions.links`);
|
|
77
|
+
return;
|
|
78
|
+
}
|
|
79
|
+
validateIssueUrl(rule, template, errors);
|
|
80
|
+
};
|
|
81
|
+
const validateIgnoredRule = (rule, path, errors) => {
|
|
82
|
+
if (!nonEmpty(rule.comment)) {
|
|
83
|
+
errors.push(`${path}.comment must be a non-empty string`);
|
|
84
|
+
}
|
|
85
|
+
};
|
|
86
|
+
export const validateResolutionsConfig = (config) => {
|
|
87
|
+
if (!config) {
|
|
88
|
+
return;
|
|
89
|
+
}
|
|
90
|
+
const errors = [];
|
|
91
|
+
if (!Array.isArray(config.rules)) {
|
|
92
|
+
throw new Error("The provided resolutions config is invalid: resolutions.rules must be an array");
|
|
93
|
+
}
|
|
94
|
+
for (const [type, template] of Object.entries(config.links ?? {})) {
|
|
95
|
+
validateLinkTemplate(type, template, errors);
|
|
96
|
+
}
|
|
97
|
+
const issueIds = new Set();
|
|
98
|
+
config.rules.forEach((rule, index) => {
|
|
99
|
+
const path = `resolutions.rules[${index}]`;
|
|
100
|
+
const matcher = rule;
|
|
101
|
+
validateMatcher(matcher, path, errors);
|
|
102
|
+
if (matcher.resolution === "issue") {
|
|
103
|
+
validateIssueRule(matcher, path, config, issueIds, errors);
|
|
104
|
+
return;
|
|
105
|
+
}
|
|
106
|
+
if (matcher.resolution === "muted" || matcher.resolution === "accepted") {
|
|
107
|
+
validateIgnoredRule(matcher, path, errors);
|
|
108
|
+
return;
|
|
109
|
+
}
|
|
110
|
+
errors.push(`${path}.resolution must be issue, muted, or accepted`);
|
|
111
|
+
});
|
|
112
|
+
if (errors.length > 0) {
|
|
113
|
+
throw new Error(`The provided resolutions config is invalid: ${errors.join("; ")}`);
|
|
114
|
+
}
|
|
115
|
+
};
|
|
116
|
+
const matches = (rule, testResult) => {
|
|
117
|
+
const { id, allureId, externalId } = testResult.testCase ?? {};
|
|
118
|
+
const testCaseIds = [id, allureId, externalId].filter((value) => typeof value === "string");
|
|
119
|
+
return ((!rule.messageRegexp || new RegExp(rule.messageRegexp).test(testResult.error?.message ?? "")) &&
|
|
120
|
+
(!rule.testCaseId || rule.testCaseId.some((id) => testCaseIds.includes(id))) &&
|
|
121
|
+
(!rule.retryHash || (!!testResult.retryHash && rule.retryHash.includes(testResult.retryHash))) &&
|
|
122
|
+
(!rule.environment || (!!testResult.environment && rule.environment.includes(testResult.environment))));
|
|
123
|
+
};
|
|
124
|
+
export const getResolutionByRules = (testResult, config) => {
|
|
125
|
+
if ((testResult.status !== "failed" && testResult.status !== "broken") || !config?.rules.length) {
|
|
126
|
+
return undefined;
|
|
127
|
+
}
|
|
128
|
+
for (const resolution of ["issue", "muted", "accepted"]) {
|
|
129
|
+
const rule = config.rules.find((candidate) => candidate.resolution === resolution && matches(candidate, testResult));
|
|
130
|
+
if (rule) {
|
|
131
|
+
return rule;
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
return undefined;
|
|
135
|
+
};
|
|
136
|
+
export const isIgnoredFailure = (testResult) => testResult.resolution === "muted" || testResult.resolution === "accepted";
|
|
137
|
+
export const resolveExactIssuesFilePath = async (pathOrDir, label) => {
|
|
138
|
+
if (!pathOrDir)
|
|
139
|
+
return undefined;
|
|
140
|
+
const path = resolve(pathOrDir);
|
|
141
|
+
if (extname(path).toLowerCase() !== ".json") {
|
|
142
|
+
throw new Error(`Invalid ${label} path ${JSON.stringify(pathOrDir)}: expected exact .json file path`);
|
|
143
|
+
}
|
|
144
|
+
try {
|
|
145
|
+
if ((await stat(path)).isDirectory()) {
|
|
146
|
+
throw new Error(`Invalid ${label} path ${JSON.stringify(pathOrDir)}: expected file, got directory`);
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
catch (e) {
|
|
150
|
+
if (!isFileNotFoundError(e))
|
|
151
|
+
throw e;
|
|
152
|
+
}
|
|
153
|
+
return path;
|
|
154
|
+
};
|
|
155
|
+
export const writeKnownIssues = async (store, knownIssuesPath) => {
|
|
156
|
+
const path = await resolveExactIssuesFilePath(knownIssuesPath, "known issues");
|
|
157
|
+
if (!path)
|
|
158
|
+
return;
|
|
159
|
+
const records = new Map();
|
|
160
|
+
for (const testResult of await store.allTestResults()) {
|
|
161
|
+
if (testResult.resolution !== "issue" || testResult.isRetry || !testResult.retryHash) {
|
|
162
|
+
continue;
|
|
163
|
+
}
|
|
164
|
+
const issue = await store.resolutionIssueByTestResultId(testResult.id);
|
|
165
|
+
if (!issue || (testResult.status !== "failed" && testResult.status !== "broken")) {
|
|
166
|
+
continue;
|
|
167
|
+
}
|
|
168
|
+
const record = records.get(issue.id) ?? { ...issue, testResults: {} };
|
|
169
|
+
record.testResults[testResult.retryHash] = {
|
|
170
|
+
name: testResult.name,
|
|
171
|
+
fullName: testResult.fullName,
|
|
172
|
+
environment: testResult.environment,
|
|
173
|
+
status: testResult.status,
|
|
174
|
+
error: testResult.error,
|
|
175
|
+
};
|
|
176
|
+
records.set(issue.id, record);
|
|
177
|
+
}
|
|
178
|
+
const file = { resolutionIssues: [...records.values()].sort((a, b) => a.id.localeCompare(b.id)) };
|
|
179
|
+
await mkdir(dirname(path), { recursive: true });
|
|
180
|
+
await writeFile(path, `${JSON.stringify(file)}\n`, "utf-8");
|
|
181
|
+
};
|
package/dist/store/convert.js
CHANGED
|
@@ -53,7 +53,6 @@ export const testResultRawToState = (stateData, raw, context) => {
|
|
|
53
53
|
expectedResultHtml: raw.expectedResultHtml,
|
|
54
54
|
flaky: raw.flaky ?? false,
|
|
55
55
|
muted: raw.muted ?? false,
|
|
56
|
-
known: raw.known ?? false,
|
|
57
56
|
isRetry: false,
|
|
58
57
|
labels,
|
|
59
58
|
steps: convertSteps(stateData, raw.steps).convertedSteps,
|
package/dist/store/store.d.ts
CHANGED
|
@@ -1,11 +1,10 @@
|
|
|
1
|
-
import { type AllureCheckResult, type AllureHistory, type AttachmentLink, type DefaultLabelsConfig, type EnvironmentIdentity, type EnvironmentsConfig, type GlobalAttachmentLink, type HistoryDataPoint, type HistoryTestResult, type
|
|
1
|
+
import { type AllureCheckResult, type AllureHistory, type AllurePerformanceResult, type AttachmentLink, type DefaultLabelsConfig, type EnvironmentIdentity, type EnvironmentsConfig, type GlobalAttachmentLink, type HistoryDataPoint, type HistoryTestResult, type ResolutionIssue, type ResolutionsConfig, type MetricSample, type PerformanceConfig, type ReportVariables, type Statistic, type TestCase, type TestEnvGroup, type TestError, type TestFixtureResult, type TestResult } from "@allurereport/core-api";
|
|
2
2
|
import { type AllureStore, type AllureStoreDump, type ExitCode, type PluginGlobalError, type QualityGateValidationResult, type RealtimeEventsDispatcher, type RealtimeSubscriber, type ResultFile, type TestResultFilter } from "@allurereport/plugin-api";
|
|
3
3
|
import type { RawFixtureResult, RawGlobals, RawMetadata, RawTestResult, ReaderContext, ResultsVisitor } from "@allurereport/reader-api";
|
|
4
4
|
export declare const mapToObject: <K extends string | number | symbol, T = any>(map: Map<K, T>) => Record<K, T>;
|
|
5
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
|
-
readonly known: Map<string, KnownTestFailure>;
|
|
9
8
|
readonly indexTestResultByTestCase: Map<string, TestResult[]>;
|
|
10
9
|
readonly indexTestResultByEnvironmentId: Map<string, TestResult[]>;
|
|
11
10
|
readonly indexTestResultByHistoryId: Map<string, TestResult[]>;
|
|
@@ -14,8 +13,7 @@ export declare class DefaultAllureStore implements AllureStore, ResultsVisitor {
|
|
|
14
13
|
readonly indexFixturesByTestResult: Map<string, TestFixtureResult[]>;
|
|
15
14
|
constructor(params?: {
|
|
16
15
|
history?: AllureHistory;
|
|
17
|
-
|
|
18
|
-
knownIssuesConfig?: KnownIssuesConfig;
|
|
16
|
+
resolutionsConfig?: ResolutionsConfig;
|
|
19
17
|
realtimeDispatcher?: RealtimeEventsDispatcher;
|
|
20
18
|
realtimeSubscriber?: RealtimeSubscriber;
|
|
21
19
|
defaultLabels?: DefaultLabelsConfig;
|
|
@@ -23,6 +21,7 @@ export declare class DefaultAllureStore implements AllureStore, ResultsVisitor {
|
|
|
23
21
|
allowedEnvironments?: string[];
|
|
24
22
|
environmentsConfig?: EnvironmentsConfig;
|
|
25
23
|
reportVariables?: ReportVariables;
|
|
24
|
+
performance?: PerformanceConfig;
|
|
26
25
|
});
|
|
27
26
|
readHistory(): Promise<HistoryDataPoint[]>;
|
|
28
27
|
appendHistory(history: HistoryDataPoint): Promise<void>;
|
|
@@ -37,6 +36,7 @@ export declare class DefaultAllureStore implements AllureStore, ResultsVisitor {
|
|
|
37
36
|
allGlobalAttachments(): Promise<GlobalAttachmentLink[]>;
|
|
38
37
|
allGlobalAttachmentsByEnv(): Promise<Record<string, GlobalAttachmentLink[]>>;
|
|
39
38
|
visitCheckResult(result: AllureCheckResult): Promise<void>;
|
|
39
|
+
visitMetrics(metrics: AllurePerformanceResult[], context?: ReaderContext): Promise<void>;
|
|
40
40
|
visitTestResult(raw: RawTestResult, context: ReaderContext): Promise<void>;
|
|
41
41
|
visitTestFixtureResult(result: RawFixtureResult, context: ReaderContext): Promise<void>;
|
|
42
42
|
visitAttachmentFile(resultFile: ResultFile): Promise<void>;
|
|
@@ -56,7 +56,10 @@ export declare class DefaultAllureStore implements AllureStore, ResultsVisitor {
|
|
|
56
56
|
allHistoryDataPoints(): Promise<HistoryDataPoint[]>;
|
|
57
57
|
allHistoryDataPointsByEnvironment(environment: string): Promise<HistoryDataPoint[]>;
|
|
58
58
|
allHistoryDataPointsByEnvironmentId(environmentId: string): Promise<HistoryDataPoint[]>;
|
|
59
|
-
|
|
59
|
+
allResolutionIssues(): Promise<ResolutionIssue[]>;
|
|
60
|
+
resolutionIssueByTestResultId(trId: string): Promise<ResolutionIssue | undefined>;
|
|
61
|
+
testResultsByResolutionIssueId(resolutionIssueId: string): Promise<TestResult[]>;
|
|
62
|
+
allMetrics(): Promise<MetricSample[]>;
|
|
60
63
|
allNewTestResults(filter?: TestResultFilter, history?: HistoryDataPoint[]): Promise<TestResult[]>;
|
|
61
64
|
testCaseById(tcId: string): Promise<TestCase | undefined>;
|
|
62
65
|
testResultById(trId: string): Promise<TestResult | undefined>;
|
package/dist/store/store.js
CHANGED
|
@@ -9,11 +9,11 @@ var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (
|
|
|
9
9
|
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
|
|
10
10
|
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
|
11
11
|
};
|
|
12
|
-
var _DefaultAllureStore_instances, _DefaultAllureStore_testResults, _DefaultAllureStore_environmentDisplayNames, _DefaultAllureStore_environmentNameToId, _DefaultAllureStore_attachments, _DefaultAllureStore_attachmentContents, _DefaultAllureStore_testCases, _DefaultAllureStore_metadata, _DefaultAllureStore_history,
|
|
12
|
+
var _DefaultAllureStore_instances, _DefaultAllureStore_testResults, _DefaultAllureStore_environmentDisplayNames, _DefaultAllureStore_environmentNameToId, _DefaultAllureStore_attachments, _DefaultAllureStore_attachmentContents, _DefaultAllureStore_testCases, _DefaultAllureStore_metadata, _DefaultAllureStore_history, _DefaultAllureStore_resolutionsConfig, _DefaultAllureStore_resolutionIssues, _DefaultAllureStore_testResultIdsByResolutionIssueId, _DefaultAllureStore_resolutionIssueIdByTestResultId, _DefaultAllureStore_fixtures, _DefaultAllureStore_defaultLabels, _DefaultAllureStore_environment, _DefaultAllureStore_environmentsConfig, _DefaultAllureStore_reportVariables, _DefaultAllureStore_realtimeDispatcher, _DefaultAllureStore_realtimeSubscriber, _DefaultAllureStore_allowedEnvironmentIds, _DefaultAllureStore_retrySubstore, _DefaultAllureStore_testResultIdsByEnvironmentId, _DefaultAllureStore_cachedEnvironmentEntries, _DefaultAllureStore_globalAttachmentIds, _DefaultAllureStore_globalAttachmentIdsByEnv, _DefaultAllureStore_globalErrors, _DefaultAllureStore_globalErrorsByEnv, _DefaultAllureStore_globalExitCode, _DefaultAllureStore_checkResultsById, _DefaultAllureStore_qualityGateResults, _DefaultAllureStore_metrics, _DefaultAllureStore_performance, _DefaultAllureStore_historyPoints, _DefaultAllureStore_environments, _DefaultAllureStore_mergeEnvironmentIdentity, _DefaultAllureStore_environmentIdForLookup, _DefaultAllureStore_addEnvironments, _DefaultAllureStore_environmentIdByName, _DefaultAllureStore_setTestResultEnvironmentId, _DefaultAllureStore_assertAllowedEnvironmentId, _DefaultAllureStore_assertAllowedStoredEnvironment, _DefaultAllureStore_environmentIdByTestResult, _DefaultAllureStore_assignRetryHash, _DefaultAllureStore_classifyResolution, _DefaultAllureStore_associateResolutionIssue, _DefaultAllureStore_removeResolutionIssueAssociation, _DefaultAllureStore_rebuildRetrySubstore, _DefaultAllureStore_resolveGlobalEnvironmentIdentity, _DefaultAllureStore_globalAttachmentId, _DefaultAllureStore_indexGlobalError, _DefaultAllureStore_addGlobalError, _DefaultAllureStore_indexGlobalAttachment, _DefaultAllureStore_addGlobalAttachment, _DefaultAllureStore_restoreAttachmentContent, _DefaultAllureStore_relinkRestoredAttachmentSteps, _DefaultAllureStore_retriesByTr, _DefaultAllureStore_historyByTr;
|
|
13
13
|
import { extname } from "node:path";
|
|
14
|
-
import { DEFAULT_ENVIRONMENT, DEFAULT_ENVIRONMENT_IDENTITY, compareBy, createDictionary, getHistoryIdCandidates, getWorstStatus, normalizeHistoryDataPoint, ordinal, reverse, selectHistoryTestResults, validateEnvironmentId, validateEnvironmentName, } from "@allurereport/core-api";
|
|
14
|
+
import { DEFAULT_ENVIRONMENT, DEFAULT_ENVIRONMENT_IDENTITY, compareBy, createDictionary, getHistoryIdCandidates, getWorstStatus, normalizeHistoryDataPoint, ordinal, reverse, resolveMetricSamples, selectHistoryTestResults, validateEnvironmentId, validateEnvironmentName, } from "@allurereport/core-api";
|
|
15
15
|
import { md5, } from "@allurereport/plugin-api";
|
|
16
|
-
import {
|
|
16
|
+
import { getResolutionByRules, isIgnoredFailure } from "../resolutions.js";
|
|
17
17
|
import { environmentIdentityById, normalizeEnvironmentDescriptorMap, resolveEnvironmentIdentity, resolveStoredEnvironmentIdentity, validateAllowedEnvironmentId, } from "../utils/environment.js";
|
|
18
18
|
import { isFlaky } from "../utils/flaky.js";
|
|
19
19
|
import { getStatusTransition } from "../utils/new.js";
|
|
@@ -64,8 +64,10 @@ export class DefaultAllureStore {
|
|
|
64
64
|
_DefaultAllureStore_testCases.set(this, void 0);
|
|
65
65
|
_DefaultAllureStore_metadata.set(this, void 0);
|
|
66
66
|
_DefaultAllureStore_history.set(this, void 0);
|
|
67
|
-
|
|
68
|
-
this
|
|
67
|
+
_DefaultAllureStore_resolutionsConfig.set(this, void 0);
|
|
68
|
+
_DefaultAllureStore_resolutionIssues.set(this, new Map());
|
|
69
|
+
_DefaultAllureStore_testResultIdsByResolutionIssueId.set(this, new Map());
|
|
70
|
+
_DefaultAllureStore_resolutionIssueIdByTestResultId.set(this, new Map());
|
|
69
71
|
_DefaultAllureStore_fixtures.set(this, void 0);
|
|
70
72
|
_DefaultAllureStore_defaultLabels.set(this, {});
|
|
71
73
|
_DefaultAllureStore_environment.set(this, void 0);
|
|
@@ -90,9 +92,11 @@ export class DefaultAllureStore {
|
|
|
90
92
|
_DefaultAllureStore_globalExitCode.set(this, void 0);
|
|
91
93
|
_DefaultAllureStore_checkResultsById.set(this, new Map());
|
|
92
94
|
_DefaultAllureStore_qualityGateResults.set(this, []);
|
|
95
|
+
_DefaultAllureStore_metrics.set(this, []);
|
|
96
|
+
_DefaultAllureStore_performance.set(this, {});
|
|
93
97
|
_DefaultAllureStore_historyPoints.set(this, []);
|
|
94
98
|
_DefaultAllureStore_environments.set(this, []);
|
|
95
|
-
const { history,
|
|
99
|
+
const { history, resolutionsConfig, realtimeDispatcher, realtimeSubscriber, defaultLabels = {}, environment, allowedEnvironments, environmentsConfig = {}, reportVariables = {}, performance = {}, } = params ?? {};
|
|
96
100
|
const errors = [];
|
|
97
101
|
const { normalized: normalizedEnvironmentsConfig, identities, errors: configErrors, } = normalizeEnvironmentDescriptorMap(environmentsConfig, "environmentsConfig");
|
|
98
102
|
errors.push(...configErrors);
|
|
@@ -117,8 +121,8 @@ export class DefaultAllureStore {
|
|
|
117
121
|
__classPrivateFieldSet(this, _DefaultAllureStore_metadata, new Map(), "f");
|
|
118
122
|
__classPrivateFieldSet(this, _DefaultAllureStore_fixtures, new Map(), "f");
|
|
119
123
|
__classPrivateFieldSet(this, _DefaultAllureStore_history, history, "f");
|
|
120
|
-
__classPrivateFieldSet(this,
|
|
121
|
-
|
|
124
|
+
__classPrivateFieldSet(this, _DefaultAllureStore_resolutionsConfig, resolutionsConfig, "f");
|
|
125
|
+
__classPrivateFieldSet(this, _DefaultAllureStore_performance, performance, "f");
|
|
122
126
|
__classPrivateFieldSet(this, _DefaultAllureStore_realtimeDispatcher, realtimeDispatcher, "f");
|
|
123
127
|
__classPrivateFieldSet(this, _DefaultAllureStore_realtimeSubscriber, realtimeSubscriber, "f");
|
|
124
128
|
__classPrivateFieldSet(this, _DefaultAllureStore_defaultLabels, defaultLabels, "f");
|
|
@@ -289,6 +293,13 @@ export class DefaultAllureStore {
|
|
|
289
293
|
async visitCheckResult(result) {
|
|
290
294
|
await this.addCheckResult(result);
|
|
291
295
|
}
|
|
296
|
+
async visitMetrics(metrics, context = { readerId: "api" }) {
|
|
297
|
+
const source = context.metadata?.originalFileName;
|
|
298
|
+
__classPrivateFieldGet(this, _DefaultAllureStore_metrics, "f").push(...resolveMetricSamples(metrics.map((metric) => ({
|
|
299
|
+
...metric,
|
|
300
|
+
...(source ? { source } : {}),
|
|
301
|
+
})), __classPrivateFieldGet(this, _DefaultAllureStore_performance, "f")));
|
|
302
|
+
}
|
|
292
303
|
async visitTestResult(raw, context) {
|
|
293
304
|
const attachmentLinks = [];
|
|
294
305
|
const testResult = testResultRawToState({
|
|
@@ -330,7 +341,7 @@ export class DefaultAllureStore {
|
|
|
330
341
|
testResult.transition = getStatusTransition(testResult, trHistory);
|
|
331
342
|
testResult.flaky = isFlaky(testResult, trHistory);
|
|
332
343
|
}
|
|
333
|
-
|
|
344
|
+
__classPrivateFieldGet(this, _DefaultAllureStore_instances, "m", _DefaultAllureStore_classifyResolution).call(this, testResult);
|
|
334
345
|
__classPrivateFieldGet(this, _DefaultAllureStore_testResults, "f").set(testResult.id, testResult);
|
|
335
346
|
__classPrivateFieldGet(this, _DefaultAllureStore_instances, "m", _DefaultAllureStore_setTestResultEnvironmentId).call(this, testResult, environmentIdentity.id);
|
|
336
347
|
__classPrivateFieldGet(this, _DefaultAllureStore_retrySubstore, "f").recordIngestOrder(testResult.id);
|
|
@@ -512,8 +523,24 @@ export class DefaultAllureStore {
|
|
|
512
523
|
return result;
|
|
513
524
|
}, []);
|
|
514
525
|
}
|
|
515
|
-
async
|
|
516
|
-
return [...this.
|
|
526
|
+
async allResolutionIssues() {
|
|
527
|
+
return [...__classPrivateFieldGet(this, _DefaultAllureStore_resolutionIssues, "f").values()];
|
|
528
|
+
}
|
|
529
|
+
async resolutionIssueByTestResultId(trId) {
|
|
530
|
+
const issueId = __classPrivateFieldGet(this, _DefaultAllureStore_resolutionIssueIdByTestResultId, "f").get(trId);
|
|
531
|
+
return issueId ? __classPrivateFieldGet(this, _DefaultAllureStore_resolutionIssues, "f").get(issueId) : undefined;
|
|
532
|
+
}
|
|
533
|
+
async testResultsByResolutionIssueId(resolutionIssueId) {
|
|
534
|
+
const testResultIds = __classPrivateFieldGet(this, _DefaultAllureStore_testResultIdsByResolutionIssueId, "f").get(resolutionIssueId);
|
|
535
|
+
if (!testResultIds) {
|
|
536
|
+
return [];
|
|
537
|
+
}
|
|
538
|
+
return [...testResultIds]
|
|
539
|
+
.map((testResultId) => __classPrivateFieldGet(this, _DefaultAllureStore_testResults, "f").get(testResultId))
|
|
540
|
+
.filter(Boolean);
|
|
541
|
+
}
|
|
542
|
+
async allMetrics() {
|
|
543
|
+
return [...__classPrivateFieldGet(this, _DefaultAllureStore_metrics, "f")];
|
|
517
544
|
}
|
|
518
545
|
async allNewTestResults(filter, history) {
|
|
519
546
|
if (!__classPrivateFieldGet(this, _DefaultAllureStore_history, "f") && !history) {
|
|
@@ -631,7 +658,7 @@ export class DefaultAllureStore {
|
|
|
631
658
|
}
|
|
632
659
|
async blockingFailedTestResults() {
|
|
633
660
|
const failedTestResults = await this.failedTestResults();
|
|
634
|
-
return failedTestResults.filter((tr) => !tr
|
|
661
|
+
return failedTestResults.filter((tr) => !isIgnoredFailure(tr));
|
|
635
662
|
}
|
|
636
663
|
async unknownFailedTestResults() {
|
|
637
664
|
return this.blockingFailedTestResults();
|
|
@@ -659,6 +686,20 @@ export class DefaultAllureStore {
|
|
|
659
686
|
}
|
|
660
687
|
async testsStatistic(filter) {
|
|
661
688
|
const statistic = { total: 0 };
|
|
689
|
+
const incrementResolution = (tr) => {
|
|
690
|
+
if (tr.resolution === "issue") {
|
|
691
|
+
statistic.resolutions ?? (statistic.resolutions = {});
|
|
692
|
+
statistic.resolutions.issues = (statistic.resolutions.issues ?? 0) + 1;
|
|
693
|
+
}
|
|
694
|
+
if (tr.resolution === "muted") {
|
|
695
|
+
statistic.resolutions ?? (statistic.resolutions = {});
|
|
696
|
+
statistic.resolutions.muted = (statistic.resolutions.muted ?? 0) + 1;
|
|
697
|
+
}
|
|
698
|
+
if (tr.resolution === "accepted") {
|
|
699
|
+
statistic.resolutions ?? (statistic.resolutions = {});
|
|
700
|
+
statistic.resolutions.accepted = (statistic.resolutions.accepted ?? 0) + 1;
|
|
701
|
+
}
|
|
702
|
+
};
|
|
662
703
|
for (const [, tr] of __classPrivateFieldGet(this, _DefaultAllureStore_testResults, "f")) {
|
|
663
704
|
if (tr.isRetry) {
|
|
664
705
|
continue;
|
|
@@ -677,6 +718,7 @@ export class DefaultAllureStore {
|
|
|
677
718
|
if (tr.transition === "new") {
|
|
678
719
|
statistic.new = (statistic.new ?? 0) + 1;
|
|
679
720
|
}
|
|
721
|
+
incrementResolution(tr);
|
|
680
722
|
if (!statistic[tr.status]) {
|
|
681
723
|
statistic[tr.status] = 0;
|
|
682
724
|
}
|
|
@@ -792,10 +834,12 @@ export class DefaultAllureStore {
|
|
|
792
834
|
indexAttachmentByTestResult: {},
|
|
793
835
|
indexTestResultByHistoryId: {},
|
|
794
836
|
indexTestResultByTestCase: {},
|
|
837
|
+
indexTestResultByResolutionIssue: {},
|
|
795
838
|
indexAttachmentByFixture: {},
|
|
796
839
|
indexFixturesByTestResult: {},
|
|
797
|
-
|
|
840
|
+
resolutionIssues: mapToObject(__classPrivateFieldGet(this, _DefaultAllureStore_resolutionIssues, "f")),
|
|
798
841
|
qualityGateResults: __classPrivateFieldGet(this, _DefaultAllureStore_qualityGateResults, "f"),
|
|
842
|
+
metrics: __classPrivateFieldGet(this, _DefaultAllureStore_metrics, "f"),
|
|
799
843
|
testResultIdsIngestOrder: __classPrivateFieldGet(this, _DefaultAllureStore_retrySubstore, "f").ingestOrderIdsForDump(),
|
|
800
844
|
};
|
|
801
845
|
this.indexAttachmentByFixture.forEach((link, fxId) => {
|
|
@@ -810,16 +854,16 @@ export class DefaultAllureStore {
|
|
|
810
854
|
this.indexTestResultByTestCase.forEach((trs, tcId) => {
|
|
811
855
|
storeDump.indexTestResultByTestCase[tcId] = trs.map((tr) => tr.id);
|
|
812
856
|
});
|
|
857
|
+
__classPrivateFieldGet(this, _DefaultAllureStore_testResultIdsByResolutionIssueId, "f").forEach((trIds, resolutionIssueId) => {
|
|
858
|
+
storeDump.indexTestResultByResolutionIssue[resolutionIssueId] = [...trIds];
|
|
859
|
+
});
|
|
813
860
|
this.indexFixturesByTestResult.forEach((fixtures, trId) => {
|
|
814
861
|
storeDump.indexFixturesByTestResult[trId] = fixtures.map((f) => f.id);
|
|
815
862
|
});
|
|
816
|
-
this.known.forEach((known, historyId) => {
|
|
817
|
-
storeDump.knownIssues[historyId] = known;
|
|
818
|
-
});
|
|
819
863
|
return storeDump;
|
|
820
864
|
}
|
|
821
865
|
async restoreState(stateDump, attachmentsContents = {}) {
|
|
822
|
-
const { testResults, attachments, testCases, fixtures, reportVariables, environments, globalAttachmentIds = [], globalErrors = [], checkResults, indexAttachmentByTestResult = {}, indexTestResultByHistoryId = {}, indexTestResultByTestCase = {}, indexAttachmentByFixture = {}, indexFixturesByTestResult = {},
|
|
866
|
+
const { testResults, attachments, testCases, fixtures, reportVariables, environments, globalAttachmentIds = [], globalErrors = [], checkResults, indexAttachmentByTestResult = {}, indexTestResultByHistoryId = {}, indexTestResultByTestCase = {}, indexTestResultByResolutionIssue = {}, indexAttachmentByFixture = {}, indexFixturesByTestResult = {}, resolutionIssues = {}, qualityGateResults = [], metrics = [], testResultIdsIngestOrder = [], } = stateDump;
|
|
823
867
|
const storedEnvironmentAliases = environments.flatMap((environmentValue) => {
|
|
824
868
|
if (typeof environmentValue === "string") {
|
|
825
869
|
return [{ id: environmentValue, name: environmentValue }];
|
|
@@ -869,7 +913,7 @@ export class DefaultAllureStore {
|
|
|
869
913
|
envNameToId.set(id, id);
|
|
870
914
|
}
|
|
871
915
|
Object.values(testResults).forEach((testResult) => {
|
|
872
|
-
|
|
916
|
+
__classPrivateFieldGet(this, _DefaultAllureStore_instances, "m", _DefaultAllureStore_removeResolutionIssueAssociation).call(this, testResult.id);
|
|
873
917
|
__classPrivateFieldGet(this, _DefaultAllureStore_testResults, "f").set(testResult.id, testResult);
|
|
874
918
|
const storedEnvKey = typeof testResult.environment === "string" ? testResult.environment : undefined;
|
|
875
919
|
const envId = (storedEnvKey ? envNameToId.get(storedEnvKey) : undefined) ?? __classPrivateFieldGet(this, _DefaultAllureStore_instances, "m", _DefaultAllureStore_environmentIdByTestResult).call(this, testResult);
|
|
@@ -885,7 +929,18 @@ export class DefaultAllureStore {
|
|
|
885
929
|
updateMapWithRecord(__classPrivateFieldGet(this, _DefaultAllureStore_attachments, "f"), attachments);
|
|
886
930
|
updateMapWithRecord(__classPrivateFieldGet(this, _DefaultAllureStore_testCases, "f"), testCases);
|
|
887
931
|
updateMapWithRecord(__classPrivateFieldGet(this, _DefaultAllureStore_fixtures, "f"), fixtures);
|
|
888
|
-
updateMapWithRecord(this
|
|
932
|
+
updateMapWithRecord(__classPrivateFieldGet(this, _DefaultAllureStore_resolutionIssues, "f"), resolutionIssues);
|
|
933
|
+
Object.entries(indexTestResultByResolutionIssue).forEach(([resolutionIssueId, testResultIds]) => {
|
|
934
|
+
const resolutionIssue = __classPrivateFieldGet(this, _DefaultAllureStore_resolutionIssues, "f").get(resolutionIssueId);
|
|
935
|
+
if (!resolutionIssue) {
|
|
936
|
+
return;
|
|
937
|
+
}
|
|
938
|
+
testResultIds.forEach((testResultId) => {
|
|
939
|
+
if (__classPrivateFieldGet(this, _DefaultAllureStore_testResults, "f").has(testResultId)) {
|
|
940
|
+
__classPrivateFieldGet(this, _DefaultAllureStore_instances, "m", _DefaultAllureStore_associateResolutionIssue).call(this, resolutionIssue, testResultId);
|
|
941
|
+
}
|
|
942
|
+
});
|
|
943
|
+
});
|
|
889
944
|
Object.entries(attachmentsContents).forEach(([id, content]) => {
|
|
890
945
|
__classPrivateFieldGet(this, _DefaultAllureStore_instances, "m", _DefaultAllureStore_restoreAttachmentContent).call(this, id, content);
|
|
891
946
|
});
|
|
@@ -975,8 +1030,13 @@ export class DefaultAllureStore {
|
|
|
975
1030
|
existingFixtures.push(...fxs);
|
|
976
1031
|
});
|
|
977
1032
|
__classPrivateFieldGet(this, _DefaultAllureStore_instances, "m", _DefaultAllureStore_rebuildRetrySubstore).call(this);
|
|
978
|
-
|
|
979
|
-
|
|
1033
|
+
if (__classPrivateFieldGet(this, _DefaultAllureStore_resolutionsConfig, "f")) {
|
|
1034
|
+
__classPrivateFieldGet(this, _DefaultAllureStore_resolutionIssues, "f").clear();
|
|
1035
|
+
__classPrivateFieldGet(this, _DefaultAllureStore_testResultIdsByResolutionIssueId, "f").clear();
|
|
1036
|
+
__classPrivateFieldGet(this, _DefaultAllureStore_resolutionIssueIdByTestResultId, "f").clear();
|
|
1037
|
+
for (const testResult of __classPrivateFieldGet(this, _DefaultAllureStore_testResults, "f").values()) {
|
|
1038
|
+
__classPrivateFieldGet(this, _DefaultAllureStore_instances, "m", _DefaultAllureStore_classifyResolution).call(this, testResult);
|
|
1039
|
+
}
|
|
980
1040
|
}
|
|
981
1041
|
qualityGateResults.forEach((result, index) => {
|
|
982
1042
|
__classPrivateFieldGet(this, _DefaultAllureStore_instances, "m", _DefaultAllureStore_assertAllowedStoredEnvironment).call(this, {
|
|
@@ -987,11 +1047,10 @@ export class DefaultAllureStore {
|
|
|
987
1047
|
});
|
|
988
1048
|
__classPrivateFieldGet(this, _DefaultAllureStore_qualityGateResults, "f").push(result);
|
|
989
1049
|
});
|
|
1050
|
+
__classPrivateFieldGet(this, _DefaultAllureStore_metrics, "f").push(...metrics);
|
|
990
1051
|
}
|
|
991
1052
|
}
|
|
992
|
-
_DefaultAllureStore_testResults = new WeakMap(), _DefaultAllureStore_environmentDisplayNames = new WeakMap(), _DefaultAllureStore_environmentNameToId = new WeakMap(), _DefaultAllureStore_attachments = new WeakMap(), _DefaultAllureStore_attachmentContents = new WeakMap(), _DefaultAllureStore_testCases = new WeakMap(), _DefaultAllureStore_metadata = new WeakMap(), _DefaultAllureStore_history = new WeakMap(),
|
|
993
|
-
return historyIdCandidates.find((historyId) => indexByHistoryId.has(historyId));
|
|
994
|
-
}, _DefaultAllureStore_mergeEnvironmentIdentity = function _DefaultAllureStore_mergeEnvironmentIdentity(existingEnvironment, incomingEnvironment) {
|
|
1053
|
+
_DefaultAllureStore_testResults = new WeakMap(), _DefaultAllureStore_environmentDisplayNames = new WeakMap(), _DefaultAllureStore_environmentNameToId = new WeakMap(), _DefaultAllureStore_attachments = new WeakMap(), _DefaultAllureStore_attachmentContents = new WeakMap(), _DefaultAllureStore_testCases = new WeakMap(), _DefaultAllureStore_metadata = new WeakMap(), _DefaultAllureStore_history = new WeakMap(), _DefaultAllureStore_resolutionsConfig = new WeakMap(), _DefaultAllureStore_resolutionIssues = new WeakMap(), _DefaultAllureStore_testResultIdsByResolutionIssueId = new WeakMap(), _DefaultAllureStore_resolutionIssueIdByTestResultId = new WeakMap(), _DefaultAllureStore_fixtures = new WeakMap(), _DefaultAllureStore_defaultLabels = new WeakMap(), _DefaultAllureStore_environment = new WeakMap(), _DefaultAllureStore_environmentsConfig = new WeakMap(), _DefaultAllureStore_reportVariables = new WeakMap(), _DefaultAllureStore_realtimeDispatcher = new WeakMap(), _DefaultAllureStore_realtimeSubscriber = new WeakMap(), _DefaultAllureStore_allowedEnvironmentIds = new WeakMap(), _DefaultAllureStore_retrySubstore = new WeakMap(), _DefaultAllureStore_testResultIdsByEnvironmentId = new WeakMap(), _DefaultAllureStore_cachedEnvironmentEntries = new WeakMap(), _DefaultAllureStore_globalAttachmentIds = new WeakMap(), _DefaultAllureStore_globalAttachmentIdsByEnv = new WeakMap(), _DefaultAllureStore_globalErrors = new WeakMap(), _DefaultAllureStore_globalErrorsByEnv = new WeakMap(), _DefaultAllureStore_globalExitCode = new WeakMap(), _DefaultAllureStore_checkResultsById = new WeakMap(), _DefaultAllureStore_qualityGateResults = new WeakMap(), _DefaultAllureStore_metrics = new WeakMap(), _DefaultAllureStore_performance = new WeakMap(), _DefaultAllureStore_historyPoints = new WeakMap(), _DefaultAllureStore_environments = new WeakMap(), _DefaultAllureStore_instances = new WeakSet(), _DefaultAllureStore_mergeEnvironmentIdentity = function _DefaultAllureStore_mergeEnvironmentIdentity(existingEnvironment, incomingEnvironment) {
|
|
995
1054
|
const configuredEnvironment = environmentIdentityById(__classPrivateFieldGet(this, _DefaultAllureStore_environmentsConfig, "f"), incomingEnvironment.id);
|
|
996
1055
|
if (configuredEnvironment) {
|
|
997
1056
|
return configuredEnvironment;
|
|
@@ -1093,23 +1152,36 @@ _DefaultAllureStore_testResults = new WeakMap(), _DefaultAllureStore_environment
|
|
|
1093
1152
|
const environmentId = options?.environmentId ?? __classPrivateFieldGet(this, _DefaultAllureStore_instances, "m", _DefaultAllureStore_environmentIdByTestResult).call(this, testResult);
|
|
1094
1153
|
const parametersHash = options?.parametersHash ?? calculateParametersHash(testResult.parameters);
|
|
1095
1154
|
testResult.retryHash = calculateRetryHash(testResult.testCase?.id, parametersHash, environmentId);
|
|
1096
|
-
},
|
|
1097
|
-
|
|
1098
|
-
|
|
1099
|
-
|
|
1100
|
-
|
|
1155
|
+
}, _DefaultAllureStore_classifyResolution = function _DefaultAllureStore_classifyResolution(testResult) {
|
|
1156
|
+
const rule = getResolutionByRules(testResult, __classPrivateFieldGet(this, _DefaultAllureStore_resolutionsConfig, "f"));
|
|
1157
|
+
testResult.resolution = rule?.resolution;
|
|
1158
|
+
testResult.resolutionComment = rule?.comment;
|
|
1159
|
+
__classPrivateFieldGet(this, _DefaultAllureStore_instances, "m", _DefaultAllureStore_removeResolutionIssueAssociation).call(this, testResult.id);
|
|
1160
|
+
if (rule?.resolution !== "issue") {
|
|
1161
|
+
return;
|
|
1101
1162
|
}
|
|
1102
|
-
const
|
|
1103
|
-
|
|
1104
|
-
|
|
1163
|
+
const resolutionIssue = { ...rule.issue, comment: rule.comment };
|
|
1164
|
+
__classPrivateFieldGet(this, _DefaultAllureStore_instances, "m", _DefaultAllureStore_associateResolutionIssue).call(this, resolutionIssue, testResult.id);
|
|
1165
|
+
}, _DefaultAllureStore_associateResolutionIssue = function _DefaultAllureStore_associateResolutionIssue(resolutionIssue, testResultId) {
|
|
1166
|
+
__classPrivateFieldGet(this, _DefaultAllureStore_instances, "m", _DefaultAllureStore_removeResolutionIssueAssociation).call(this, testResultId);
|
|
1167
|
+
__classPrivateFieldGet(this, _DefaultAllureStore_resolutionIssues, "f").set(resolutionIssue.id, resolutionIssue);
|
|
1168
|
+
const testResultIds = __classPrivateFieldGet(this, _DefaultAllureStore_testResultIdsByResolutionIssueId, "f").get(resolutionIssue.id) ?? new Set();
|
|
1169
|
+
testResultIds.add(testResultId);
|
|
1170
|
+
__classPrivateFieldGet(this, _DefaultAllureStore_testResultIdsByResolutionIssueId, "f").set(resolutionIssue.id, testResultIds);
|
|
1171
|
+
__classPrivateFieldGet(this, _DefaultAllureStore_resolutionIssueIdByTestResultId, "f").set(testResultId, resolutionIssue.id);
|
|
1172
|
+
}, _DefaultAllureStore_removeResolutionIssueAssociation = function _DefaultAllureStore_removeResolutionIssueAssociation(testResultId) {
|
|
1173
|
+
const resolutionIssueId = __classPrivateFieldGet(this, _DefaultAllureStore_resolutionIssueIdByTestResultId, "f").get(testResultId);
|
|
1174
|
+
if (!resolutionIssueId) {
|
|
1175
|
+
return;
|
|
1105
1176
|
}
|
|
1106
|
-
|
|
1107
|
-
|
|
1108
|
-
|
|
1109
|
-
|
|
1177
|
+
__classPrivateFieldGet(this, _DefaultAllureStore_resolutionIssueIdByTestResultId, "f").delete(testResultId);
|
|
1178
|
+
const testResultIds = __classPrivateFieldGet(this, _DefaultAllureStore_testResultIdsByResolutionIssueId, "f").get(resolutionIssueId);
|
|
1179
|
+
testResultIds?.delete(testResultId);
|
|
1180
|
+
if (testResultIds?.size) {
|
|
1181
|
+
return;
|
|
1110
1182
|
}
|
|
1111
|
-
|
|
1112
|
-
|
|
1183
|
+
__classPrivateFieldGet(this, _DefaultAllureStore_testResultIdsByResolutionIssueId, "f").delete(resolutionIssueId);
|
|
1184
|
+
__classPrivateFieldGet(this, _DefaultAllureStore_resolutionIssues, "f").delete(resolutionIssueId);
|
|
1113
1185
|
}, _DefaultAllureStore_rebuildRetrySubstore = function _DefaultAllureStore_rebuildRetrySubstore() {
|
|
1114
1186
|
__classPrivateFieldGet(this, _DefaultAllureStore_retrySubstore, "f").reset();
|
|
1115
1187
|
for (const [, testResult] of __classPrivateFieldGet(this, _DefaultAllureStore_testResults, "f")) {
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
export declare const ARTIFACTS_MANIFEST_FILENAME = "artifacts.json";
|
|
2
|
+
export type ReportArtifact = {
|
|
3
|
+
name: string;
|
|
4
|
+
path: string;
|
|
5
|
+
};
|
|
6
|
+
export type ReportArtifactsManifest = ReportArtifact[];
|
|
7
|
+
export type RestoreStateDumpInput = {
|
|
8
|
+
artifactPath?: string;
|
|
9
|
+
path: string;
|
|
10
|
+
recordArtifact?: boolean;
|
|
11
|
+
};
|
|
12
|
+
export declare const normalizeArtifactPath: (filePath: string, cwd: string) => string;
|
|
13
|
+
export declare const createReportArtifact: (filePath: string, cwd: string, name?: string) => ReportArtifact;
|
|
14
|
+
export declare const deduplicateDumpInputs: (dumps: RestoreStateDumpInput[], cwd: string) => RestoreStateDumpInput[];
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { realpathSync } from "node:fs";
|
|
2
|
+
import { basename, relative, resolve, sep } from "node:path";
|
|
3
|
+
export const ARTIFACTS_MANIFEST_FILENAME = "artifacts.json";
|
|
4
|
+
const existingRealPath = (filePath) => {
|
|
5
|
+
try {
|
|
6
|
+
return realpathSync(filePath);
|
|
7
|
+
}
|
|
8
|
+
catch {
|
|
9
|
+
return filePath;
|
|
10
|
+
}
|
|
11
|
+
};
|
|
12
|
+
export const normalizeArtifactPath = (filePath, cwd) => {
|
|
13
|
+
const path = relative(resolve(cwd), resolve(cwd, filePath)).split(sep).join("/");
|
|
14
|
+
return path || ".";
|
|
15
|
+
};
|
|
16
|
+
export const createReportArtifact = (filePath, cwd, name = basename(filePath)) => ({
|
|
17
|
+
name,
|
|
18
|
+
path: normalizeArtifactPath(filePath, cwd),
|
|
19
|
+
});
|
|
20
|
+
export const deduplicateDumpInputs = (dumps, cwd) => {
|
|
21
|
+
const seen = new Set();
|
|
22
|
+
return dumps.reduce((acc, dump) => {
|
|
23
|
+
const absolutePath = resolve(cwd, dump.path);
|
|
24
|
+
const dedupeKey = existingRealPath(absolutePath);
|
|
25
|
+
if (seen.has(dedupeKey)) {
|
|
26
|
+
return acc;
|
|
27
|
+
}
|
|
28
|
+
seen.add(dedupeKey);
|
|
29
|
+
acc.push({
|
|
30
|
+
...dump,
|
|
31
|
+
path: absolutePath,
|
|
32
|
+
});
|
|
33
|
+
return acc;
|
|
34
|
+
}, []);
|
|
35
|
+
};
|
package/dist/utils/perf.d.ts
CHANGED
|
@@ -1,4 +1,6 @@
|
|
|
1
|
-
|
|
1
|
+
import type { AllurePerformanceResult } from "@allurereport/core-api";
|
|
2
|
+
export declare const PERF_METRICS_FILE = "performance.json";
|
|
3
|
+
export declare const perfMetricsFileName: (reportUuid: string) => string;
|
|
2
4
|
export type PerfMetricSpan = {
|
|
3
5
|
name: string;
|
|
4
6
|
startTimeMs: number;
|
|
@@ -12,14 +14,8 @@ export type PerfMetricSummary = {
|
|
|
12
14
|
maxMs: number;
|
|
13
15
|
avgMs: number;
|
|
14
16
|
};
|
|
15
|
-
export type PerfMetricsPayload = {
|
|
16
|
-
version: 1;
|
|
17
|
-
generatedAt: string;
|
|
18
|
-
timeOriginMs: number;
|
|
19
|
-
spans: PerfMetricSpan[];
|
|
20
|
-
summary: PerfMetricSummary[];
|
|
21
|
-
};
|
|
22
17
|
export declare const PERF_METRIC_NAMES: {
|
|
18
|
+
readonly allureTotal: "allure.total";
|
|
23
19
|
readonly restoreStateTotal: "restoreState.total";
|
|
24
20
|
readonly restoreStateDump: "restoreState.dump";
|
|
25
21
|
readonly restoreStateAttachments: "restoreState.attachments";
|
|
@@ -37,6 +33,6 @@ export declare const PERF_METRIC_PREFIXES: {
|
|
|
37
33
|
export declare const isPerfMetricsEnabled: () => boolean;
|
|
38
34
|
export declare const startPerfSpan: (name: string) => (() => void);
|
|
39
35
|
export declare const measurePerf: <T>(name: string, fn: () => Promise<T>) => Promise<T>;
|
|
40
|
-
export declare const
|
|
41
|
-
export declare const writePerfMetrics: (output: string) => Promise<boolean>;
|
|
36
|
+
export declare const getPerfMetricsResults: () => AllurePerformanceResult[];
|
|
37
|
+
export declare const writePerfMetrics: (output: string, fileName?: string) => Promise<boolean>;
|
|
42
38
|
export declare const resetPerfMetrics: () => void;
|