@allurereport/core 3.18.0 → 3.19.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.js +15 -0
- package/dist/history.js +7 -5
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1 -1
- package/dist/qualityGate/qualityGate.js +1 -1
- package/dist/qualityGate/rules.d.ts +2 -1
- package/dist/qualityGate/rules.js +29 -4
- package/dist/report.js +56 -16
- package/dist/store/convert.d.ts +0 -1
- package/dist/store/convert.js +71 -58
- package/dist/store/retrySubstore.d.ts +1 -3
- package/dist/store/retrySubstore.js +0 -14
- package/dist/store/store.d.ts +4 -2
- package/dist/store/store.js +223 -197
- package/dist/utils/event.d.ts +1 -1
- package/dist/utils/event.js +9 -4
- package/dist/utils/flaky.d.ts +2 -2
- package/dist/utils/flaky.js +36 -8
- package/dist/utils/perf.d.ts +24 -12
- package/dist/utils/perf.js +116 -16
- package/dist/utils/realtimeChannel.d.ts +1 -0
- package/dist/utils/realtimeChannel.js +2 -2
- package/package.json +22 -22
package/dist/store/store.js
CHANGED
|
@@ -9,16 +9,17 @@ 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,
|
|
12
|
+
var _DefaultAllureStore_instances, _DefaultAllureStore_testResults, _DefaultAllureStore_attachments, _DefaultAllureStore_attachmentContents, _DefaultAllureStore_testCases, _DefaultAllureStore_metadata, _DefaultAllureStore_history, _DefaultAllureStore_detectFlaky, _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_globalAttachmentIds, _DefaultAllureStore_globalAttachmentIdsByEnv, _DefaultAllureStore_globalErrors, _DefaultAllureStore_globalErrorsByEnv, _DefaultAllureStore_processGlobalAttachmentIds, _DefaultAllureStore_processGlobalAttachmentIdsByEnv, _DefaultAllureStore_processGlobalErrors, _DefaultAllureStore_processGlobalErrorsByEnv, _DefaultAllureStore_globalExitCode, _DefaultAllureStore_checkResultsById, _DefaultAllureStore_qualityGateResults, _DefaultAllureStore_metrics, _DefaultAllureStore_performance, _DefaultAllureStore_historyPoints, _DefaultAllureStore_historyLookup, _DefaultAllureStore_environments, _DefaultAllureStore_mergeEnvironmentIdentity, _DefaultAllureStore_environmentIdForLookup, _DefaultAllureStore_environmentIdByName, _DefaultAllureStore_addEnvironments, _DefaultAllureStore_setTestResultEnvironmentId, _DefaultAllureStore_assertAllowedEnvironmentId, _DefaultAllureStore_assertAllowedStoredEnvironment, _DefaultAllureStore_environmentIdByTestResult, _DefaultAllureStore_assignIdentityHashes, _DefaultAllureStore_classifyResolution, _DefaultAllureStore_associateResolutionIssue, _DefaultAllureStore_removeResolutionIssueAssociation, _DefaultAllureStore_rebuildRetrySubstore, _DefaultAllureStore_rebuildIdentityIndexes, _DefaultAllureStore_rebuildEnvironmentIndexes, _DefaultAllureStore_resolveGlobalEnvironmentIdentity, _DefaultAllureStore_globalAttachmentId, _DefaultAllureStore_processGlobalAttachmentId, _DefaultAllureStore_indexGlobalError, _DefaultAllureStore_addGlobalError, _DefaultAllureStore_indexGlobalAttachment, _DefaultAllureStore_addGlobalAttachment, _DefaultAllureStore_resetProcessGlobals, _DefaultAllureStore_getHistoryLookup, _DefaultAllureStore_historyFor, _DefaultAllureStore_applyHistoryFlags, _DefaultAllureStore_restoreAttachmentContent, _DefaultAllureStore_relinkRestoredAttachmentSteps, _DefaultAllureStore_retriesByTr, _DefaultAllureStore_historyByTr;
|
|
13
13
|
import { extname } from "node:path";
|
|
14
|
-
import { DEFAULT_ENVIRONMENT, DEFAULT_ENVIRONMENT_IDENTITY, compareBy, createDictionary,
|
|
14
|
+
import { DEFAULT_ENVIRONMENT, DEFAULT_ENVIRONMENT_IDENTITY, calculateEnvironmentHash, calculateParametersHash, calculateRetryHash, calculateTestCaseHash, compareBy, createDictionary, fallbackTestCaseIdLabelName, getWorstStatus, createHistoryTestResultLookup, normalizeHistoryDataPoint, ordinal, reverse, resolveMetricSamples, validateEnvironmentId, validateEnvironmentName, } from "@allurereport/core-api";
|
|
15
15
|
import { md5, } from "@allurereport/plugin-api";
|
|
16
16
|
import { getResolutionByRules, isIgnoredFailure } from "../resolutions.js";
|
|
17
17
|
import { environmentIdentityById, normalizeEnvironmentDescriptorMap, resolveEnvironmentIdentity, resolveStoredEnvironmentIdentity, validateAllowedEnvironmentId, } from "../utils/environment.js";
|
|
18
|
-
import {
|
|
18
|
+
import { createFlakyDetector } from "../utils/flaky.js";
|
|
19
19
|
import { getStatusTransition } from "../utils/new.js";
|
|
20
|
+
import { measurePerfAggregateSync, PERF_METRIC_NAMES } from "../utils/perf.js";
|
|
20
21
|
import { testFixtureResultRawToState, testResultRawToState } from "./convert.js";
|
|
21
|
-
import {
|
|
22
|
+
import { RetrySubstore } from "./retrySubstore.js";
|
|
22
23
|
const index = (indexMap, key, ...items) => {
|
|
23
24
|
if (key) {
|
|
24
25
|
if (!indexMap.has(key)) {
|
|
@@ -57,13 +58,12 @@ export class DefaultAllureStore {
|
|
|
57
58
|
constructor(params) {
|
|
58
59
|
_DefaultAllureStore_instances.add(this);
|
|
59
60
|
_DefaultAllureStore_testResults.set(this, void 0);
|
|
60
|
-
_DefaultAllureStore_environmentDisplayNames.set(this, void 0);
|
|
61
|
-
_DefaultAllureStore_environmentNameToId.set(this, void 0);
|
|
62
61
|
_DefaultAllureStore_attachments.set(this, void 0);
|
|
63
62
|
_DefaultAllureStore_attachmentContents.set(this, void 0);
|
|
64
63
|
_DefaultAllureStore_testCases.set(this, void 0);
|
|
65
64
|
_DefaultAllureStore_metadata.set(this, void 0);
|
|
66
65
|
_DefaultAllureStore_history.set(this, void 0);
|
|
66
|
+
_DefaultAllureStore_detectFlaky.set(this, void 0);
|
|
67
67
|
_DefaultAllureStore_resolutionsConfig.set(this, void 0);
|
|
68
68
|
_DefaultAllureStore_resolutionIssues.set(this, new Map());
|
|
69
69
|
_DefaultAllureStore_testResultIdsByResolutionIssueId.set(this, new Map());
|
|
@@ -78,10 +78,9 @@ export class DefaultAllureStore {
|
|
|
78
78
|
_DefaultAllureStore_allowedEnvironmentIds.set(this, void 0);
|
|
79
79
|
_DefaultAllureStore_retrySubstore.set(this, void 0);
|
|
80
80
|
_DefaultAllureStore_testResultIdsByEnvironmentId.set(this, new Map());
|
|
81
|
-
_DefaultAllureStore_cachedEnvironmentEntries.set(this, []);
|
|
82
81
|
this.indexTestResultByTestCase = new Map();
|
|
83
82
|
this.indexTestResultByEnvironmentId = new Map();
|
|
84
|
-
this.
|
|
83
|
+
this.indexTestResultByRetryHash = new Map();
|
|
85
84
|
this.indexAttachmentByTestResult = new Map();
|
|
86
85
|
this.indexAttachmentByFixture = new Map();
|
|
87
86
|
this.indexFixturesByTestResult = new Map();
|
|
@@ -99,8 +98,9 @@ export class DefaultAllureStore {
|
|
|
99
98
|
_DefaultAllureStore_metrics.set(this, []);
|
|
100
99
|
_DefaultAllureStore_performance.set(this, {});
|
|
101
100
|
_DefaultAllureStore_historyPoints.set(this, []);
|
|
101
|
+
_DefaultAllureStore_historyLookup.set(this, void 0);
|
|
102
102
|
_DefaultAllureStore_environments.set(this, []);
|
|
103
|
-
const { history, resolutionsConfig, realtimeDispatcher, realtimeSubscriber, defaultLabels = {}, environment, allowedEnvironments, environmentsConfig = {}, reportVariables = {}, performance = {}, } = params ?? {};
|
|
103
|
+
const { history, flakyDetection, resolutionsConfig, realtimeDispatcher, realtimeSubscriber, defaultLabels = {}, environment, allowedEnvironments, environmentsConfig = {}, reportVariables = {}, performance = {}, } = params ?? {};
|
|
104
104
|
const errors = [];
|
|
105
105
|
const { normalized: normalizedEnvironmentsConfig, identities, errors: configErrors, } = normalizeEnvironmentDescriptorMap(environmentsConfig, "environmentsConfig");
|
|
106
106
|
errors.push(...configErrors);
|
|
@@ -117,14 +117,13 @@ export class DefaultAllureStore {
|
|
|
117
117
|
environments.push(resolvedEnvironment);
|
|
118
118
|
}
|
|
119
119
|
__classPrivateFieldSet(this, _DefaultAllureStore_testResults, new Map(), "f");
|
|
120
|
-
__classPrivateFieldSet(this, _DefaultAllureStore_environmentDisplayNames, new Map(), "f");
|
|
121
|
-
__classPrivateFieldSet(this, _DefaultAllureStore_environmentNameToId, new Map(), "f");
|
|
122
120
|
__classPrivateFieldSet(this, _DefaultAllureStore_attachments, new Map(), "f");
|
|
123
121
|
__classPrivateFieldSet(this, _DefaultAllureStore_attachmentContents, new Map(), "f");
|
|
124
122
|
__classPrivateFieldSet(this, _DefaultAllureStore_testCases, new Map(), "f");
|
|
125
123
|
__classPrivateFieldSet(this, _DefaultAllureStore_metadata, new Map(), "f");
|
|
126
124
|
__classPrivateFieldSet(this, _DefaultAllureStore_fixtures, new Map(), "f");
|
|
127
125
|
__classPrivateFieldSet(this, _DefaultAllureStore_history, history, "f");
|
|
126
|
+
__classPrivateFieldSet(this, _DefaultAllureStore_detectFlaky, createFlakyDetector(flakyDetection), "f");
|
|
128
127
|
__classPrivateFieldSet(this, _DefaultAllureStore_resolutionsConfig, resolutionsConfig, "f");
|
|
129
128
|
__classPrivateFieldSet(this, _DefaultAllureStore_performance, performance, "f");
|
|
130
129
|
__classPrivateFieldSet(this, _DefaultAllureStore_realtimeDispatcher, realtimeDispatcher, "f");
|
|
@@ -135,7 +134,6 @@ export class DefaultAllureStore {
|
|
|
135
134
|
__classPrivateFieldSet(this, _DefaultAllureStore_reportVariables, reportVariables, "f");
|
|
136
135
|
__classPrivateFieldSet(this, _DefaultAllureStore_allowedEnvironmentIds, new Set(allowedEnvironments ?? []), "f");
|
|
137
136
|
__classPrivateFieldSet(this, _DefaultAllureStore_retrySubstore, new RetrySubstore(), "f");
|
|
138
|
-
__classPrivateFieldSet(this, _DefaultAllureStore_cachedEnvironmentEntries, Object.entries(__classPrivateFieldGet(this, _DefaultAllureStore_environmentsConfig, "f")), "f");
|
|
139
137
|
__classPrivateFieldGet(this, _DefaultAllureStore_instances, "m", _DefaultAllureStore_addEnvironments).call(this, environments);
|
|
140
138
|
__classPrivateFieldGet(this, _DefaultAllureStore_realtimeSubscriber, "f")?.onQualityGateResults((results) => {
|
|
141
139
|
__classPrivateFieldGet(this, _DefaultAllureStore_qualityGateResults, "f").push(...results);
|
|
@@ -215,12 +213,22 @@ export class DefaultAllureStore {
|
|
|
215
213
|
if (!__classPrivateFieldGet(this, _DefaultAllureStore_history, "f")) {
|
|
216
214
|
return [];
|
|
217
215
|
}
|
|
216
|
+
__classPrivateFieldSet(this, _DefaultAllureStore_historyLookup, undefined, "f");
|
|
218
217
|
__classPrivateFieldSet(this, _DefaultAllureStore_historyPoints, ((await __classPrivateFieldGet(this, _DefaultAllureStore_history, "f").readHistory()) ?? [])
|
|
219
218
|
.filter((historyPoint) => typeof historyPoint === "object" && historyPoint !== null)
|
|
220
219
|
.map(normalizeHistoryDataPoint), "f");
|
|
221
220
|
__classPrivateFieldGet(this, _DefaultAllureStore_historyPoints, "f").sort(compareBy("timestamp", reverse(ordinal())));
|
|
222
221
|
return __classPrivateFieldGet(this, _DefaultAllureStore_historyPoints, "f");
|
|
223
222
|
}
|
|
223
|
+
updateHistoryFlags(testResults = __classPrivateFieldGet(this, _DefaultAllureStore_testResults, "f").values()) {
|
|
224
|
+
if (!__classPrivateFieldGet(this, _DefaultAllureStore_history, "f")) {
|
|
225
|
+
return;
|
|
226
|
+
}
|
|
227
|
+
const lookup = __classPrivateFieldGet(this, _DefaultAllureStore_instances, "m", _DefaultAllureStore_getHistoryLookup).call(this);
|
|
228
|
+
for (const result of testResults) {
|
|
229
|
+
__classPrivateFieldGet(this, _DefaultAllureStore_instances, "m", _DefaultAllureStore_applyHistoryFlags).call(this, result, __classPrivateFieldGet(this, _DefaultAllureStore_instances, "m", _DefaultAllureStore_historyFor).call(this, result, lookup));
|
|
230
|
+
}
|
|
231
|
+
}
|
|
224
232
|
async appendHistory(history) {
|
|
225
233
|
if (!__classPrivateFieldGet(this, _DefaultAllureStore_history, "f")) {
|
|
226
234
|
return;
|
|
@@ -341,53 +349,71 @@ export class DefaultAllureStore {
|
|
|
341
349
|
}
|
|
342
350
|
async visitTestResult(raw, context) {
|
|
343
351
|
const attachmentLinks = [];
|
|
344
|
-
const testResult = testResultRawToState({
|
|
352
|
+
const testResult = measurePerfAggregateSync(PERF_METRIC_NAMES.storeVisitTestResultConvert, () => testResultRawToState({
|
|
345
353
|
testCases: __classPrivateFieldGet(this, _DefaultAllureStore_testCases, "f"),
|
|
346
354
|
attachments: __classPrivateFieldGet(this, _DefaultAllureStore_attachments, "f"),
|
|
347
355
|
visitAttachmentLink: (link) => attachmentLinks.push(link),
|
|
348
|
-
}, raw, context);
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
defaultLabelsNames.
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
356
|
+
}, raw, context));
|
|
357
|
+
measurePerfAggregateSync(PERF_METRIC_NAMES.storeVisitTestResultDefaultLabels, () => {
|
|
358
|
+
const defaultLabelsNames = Object.keys(__classPrivateFieldGet(this, _DefaultAllureStore_defaultLabels, "f"));
|
|
359
|
+
if (defaultLabelsNames.length) {
|
|
360
|
+
defaultLabelsNames.forEach((labelName) => {
|
|
361
|
+
if (!testResult.labels.find((label) => label.name === labelName)) {
|
|
362
|
+
const defaultLabelValue = __classPrivateFieldGet(this, _DefaultAllureStore_defaultLabels, "f")[labelName];
|
|
363
|
+
[].concat(defaultLabelValue).forEach((labelValue) => {
|
|
364
|
+
testResult.labels.push({
|
|
365
|
+
name: labelName,
|
|
366
|
+
value: labelValue,
|
|
367
|
+
});
|
|
358
368
|
});
|
|
359
|
-
}
|
|
360
|
-
}
|
|
369
|
+
}
|
|
370
|
+
});
|
|
371
|
+
}
|
|
372
|
+
});
|
|
373
|
+
const environmentIdentity = measurePerfAggregateSync(PERF_METRIC_NAMES.storeVisitTestResultEnvironment, () => {
|
|
374
|
+
const environmentMatcherLabels = testResult.labels.filter(({ name }) => name !== "ALLURE_ID" && name !== fallbackTestCaseIdLabelName);
|
|
375
|
+
const environmentMatch = __classPrivateFieldGet(this, _DefaultAllureStore_environment, "f")
|
|
376
|
+
? undefined
|
|
377
|
+
: Object.entries(__classPrivateFieldGet(this, _DefaultAllureStore_environmentsConfig, "f")).find(([, { matcher }]) => matcher({ labels: environmentMatcherLabels }));
|
|
378
|
+
const namedEnvironmentIdentity = __classPrivateFieldGet(this, _DefaultAllureStore_environment, "f") ??
|
|
379
|
+
(environmentMatch
|
|
380
|
+
? {
|
|
381
|
+
id: environmentMatch[0],
|
|
382
|
+
name: environmentMatch[1].name ?? environmentMatch[0],
|
|
383
|
+
}
|
|
384
|
+
: undefined);
|
|
385
|
+
const identity = namedEnvironmentIdentity ?? DEFAULT_ENVIRONMENT_IDENTITY;
|
|
386
|
+
testResult.environment = identity.id;
|
|
387
|
+
__classPrivateFieldGet(this, _DefaultAllureStore_instances, "m", _DefaultAllureStore_addEnvironments).call(this, [identity]);
|
|
388
|
+
return identity;
|
|
389
|
+
});
|
|
390
|
+
measurePerfAggregateSync(PERF_METRIC_NAMES.storeVisitTestResultRetry, () => {
|
|
391
|
+
testResult.environmentHash = calculateEnvironmentHash(environmentIdentity.id);
|
|
392
|
+
testResult.retryHash = calculateRetryHash({
|
|
393
|
+
testCaseHash: testResult.testCaseHash,
|
|
394
|
+
parametersHash: testResult.parametersHash,
|
|
395
|
+
environmentHash: testResult.environmentHash,
|
|
396
|
+
});
|
|
397
|
+
});
|
|
398
|
+
if (__classPrivateFieldGet(this, _DefaultAllureStore_history, "f")) {
|
|
399
|
+
measurePerfAggregateSync(PERF_METRIC_NAMES.storeVisitTestResultHistory, () => {
|
|
400
|
+
const lookup = createHistoryTestResultLookup([testResult]);
|
|
401
|
+
__classPrivateFieldGet(this, _DefaultAllureStore_instances, "m", _DefaultAllureStore_applyHistoryFlags).call(this, testResult, __classPrivateFieldGet(this, _DefaultAllureStore_instances, "m", _DefaultAllureStore_historyFor).call(this, testResult, lookup));
|
|
361
402
|
});
|
|
362
403
|
}
|
|
363
|
-
|
|
364
|
-
(()
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
: calculateParametersHash(testResult.parameters);
|
|
377
|
-
testResult.retryHash = calculateRetryHash(testResult.testCase?.id, parametersHash, environmentIdentity.id);
|
|
378
|
-
const trHistory = __classPrivateFieldGet(this, _DefaultAllureStore_history, "f") ? await this.historyByTr(testResult) : undefined;
|
|
379
|
-
if (trHistory !== undefined) {
|
|
380
|
-
testResult.transition = getStatusTransition(testResult, trHistory);
|
|
381
|
-
testResult.flaky = isFlaky(testResult, trHistory);
|
|
382
|
-
}
|
|
383
|
-
__classPrivateFieldGet(this, _DefaultAllureStore_instances, "m", _DefaultAllureStore_classifyResolution).call(this, testResult);
|
|
384
|
-
__classPrivateFieldGet(this, _DefaultAllureStore_testResults, "f").set(testResult.id, testResult);
|
|
385
|
-
__classPrivateFieldGet(this, _DefaultAllureStore_instances, "m", _DefaultAllureStore_setTestResultEnvironmentId).call(this, testResult, environmentIdentity.id);
|
|
386
|
-
__classPrivateFieldGet(this, _DefaultAllureStore_retrySubstore, "f").recordIngestOrder(testResult.id);
|
|
387
|
-
__classPrivateFieldGet(this, _DefaultAllureStore_retrySubstore, "f").upsert(testResult);
|
|
388
|
-
index(this.indexTestResultByTestCase, testResult.testCase?.id, testResult);
|
|
389
|
-
index(this.indexTestResultByHistoryId, testResult.historyId, testResult);
|
|
390
|
-
index(this.indexAttachmentByTestResult, testResult.id, ...attachmentLinks);
|
|
404
|
+
measurePerfAggregateSync(PERF_METRIC_NAMES.storeVisitTestResultResolution, () => {
|
|
405
|
+
__classPrivateFieldGet(this, _DefaultAllureStore_instances, "m", _DefaultAllureStore_classifyResolution).call(this, testResult);
|
|
406
|
+
});
|
|
407
|
+
measurePerfAggregateSync(PERF_METRIC_NAMES.storeVisitTestResultIndexes, () => {
|
|
408
|
+
__classPrivateFieldGet(this, _DefaultAllureStore_testResults, "f").set(testResult.id, testResult);
|
|
409
|
+
__classPrivateFieldSet(this, _DefaultAllureStore_historyLookup, undefined, "f");
|
|
410
|
+
__classPrivateFieldGet(this, _DefaultAllureStore_instances, "m", _DefaultAllureStore_setTestResultEnvironmentId).call(this, testResult, environmentIdentity.id);
|
|
411
|
+
__classPrivateFieldGet(this, _DefaultAllureStore_retrySubstore, "f").recordIngestOrder(testResult.id);
|
|
412
|
+
__classPrivateFieldGet(this, _DefaultAllureStore_retrySubstore, "f").upsert(testResult);
|
|
413
|
+
index(this.indexTestResultByTestCase, testResult.testCase?.id, testResult);
|
|
414
|
+
index(this.indexTestResultByRetryHash, testResult.retryHash, testResult);
|
|
415
|
+
index(this.indexAttachmentByTestResult, testResult.id, ...attachmentLinks);
|
|
416
|
+
});
|
|
391
417
|
__classPrivateFieldGet(this, _DefaultAllureStore_realtimeDispatcher, "f")?.sendTestResult(testResult.id);
|
|
392
418
|
}
|
|
393
419
|
async visitTestFixtureResult(result, context) {
|
|
@@ -404,28 +430,31 @@ export class DefaultAllureStore {
|
|
|
404
430
|
__classPrivateFieldGet(this, _DefaultAllureStore_realtimeDispatcher, "f")?.sendTestFixtureResult(testFixtureResult.id);
|
|
405
431
|
}
|
|
406
432
|
async visitAttachmentFile(resultFile) {
|
|
407
|
-
const originalFileName =
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
433
|
+
const { id, originalFileName } = measurePerfAggregateSync(PERF_METRIC_NAMES.storeVisitAttachmentFileMetadata, () => {
|
|
434
|
+
const originalFileName = resultFile.getOriginalFileName();
|
|
435
|
+
const id = md5(originalFileName);
|
|
436
|
+
__classPrivateFieldGet(this, _DefaultAllureStore_attachmentContents, "f").set(id, resultFile);
|
|
437
|
+
const maybeLink = __classPrivateFieldGet(this, _DefaultAllureStore_attachments, "f").get(id);
|
|
438
|
+
if (maybeLink) {
|
|
439
|
+
const link = maybeLink;
|
|
440
|
+
link.missed = false;
|
|
441
|
+
link.ext = link.ext === undefined || link.ext === "" ? resultFile.getExtension() : link.ext;
|
|
442
|
+
link.contentType = link.contentType ?? resultFile.getContentType();
|
|
443
|
+
link.contentLength = resultFile.getContentLength();
|
|
444
|
+
}
|
|
445
|
+
else {
|
|
446
|
+
__classPrivateFieldGet(this, _DefaultAllureStore_attachments, "f").set(id, {
|
|
447
|
+
used: false,
|
|
448
|
+
missed: false,
|
|
449
|
+
id,
|
|
450
|
+
originalFileName,
|
|
451
|
+
ext: resultFile.getExtension(),
|
|
452
|
+
contentType: resultFile.getContentType(),
|
|
453
|
+
contentLength: resultFile.getContentLength(),
|
|
454
|
+
});
|
|
455
|
+
}
|
|
456
|
+
return { id, originalFileName };
|
|
457
|
+
});
|
|
429
458
|
for (const globalAttachmentId of [...__classPrivateFieldGet(this, _DefaultAllureStore_globalAttachmentIds, "f"), ...__classPrivateFieldGet(this, _DefaultAllureStore_processGlobalAttachmentIds, "f")]) {
|
|
430
459
|
const globalAttachment = __classPrivateFieldGet(this, _DefaultAllureStore_attachments, "f").get(globalAttachmentId);
|
|
431
460
|
if (!globalAttachment || globalAttachment.originalFileName !== originalFileName) {
|
|
@@ -536,14 +565,7 @@ export class DefaultAllureStore {
|
|
|
536
565
|
return __classPrivateFieldGet(this, _DefaultAllureStore_historyPoints, "f").reduce((result, dp) => {
|
|
537
566
|
const filteredTestResults = [];
|
|
538
567
|
for (const tr of Object.values(dp.testResults ?? {})) {
|
|
539
|
-
const
|
|
540
|
-
const trEnvId = (storedEnvironmentKey ? __classPrivateFieldGet(this, _DefaultAllureStore_instances, "m", _DefaultAllureStore_environmentIdByName).call(this, storedEnvironmentKey) : undefined) ??
|
|
541
|
-
resolveStoredEnvironmentIdentity({
|
|
542
|
-
environment: tr.environment,
|
|
543
|
-
labels: tr.labels ?? [],
|
|
544
|
-
}, __classPrivateFieldGet(this, _DefaultAllureStore_environmentsConfig, "f"), {
|
|
545
|
-
forcedEnvironment: __classPrivateFieldGet(this, _DefaultAllureStore_environment, "f"),
|
|
546
|
-
})?.id;
|
|
568
|
+
const trEnvId = tr.environment ?? DEFAULT_ENVIRONMENT;
|
|
547
569
|
if (trEnvId === normalizedEnvironmentId) {
|
|
548
570
|
filteredTestResults.push(tr);
|
|
549
571
|
}
|
|
@@ -554,7 +576,7 @@ export class DefaultAllureStore {
|
|
|
554
576
|
testResults: hasNoEnvironmentTestResults
|
|
555
577
|
? {}
|
|
556
578
|
: filteredTestResults.reduce((acc, tr) => {
|
|
557
|
-
acc[tr.
|
|
579
|
+
acc[tr.retryHash] = tr;
|
|
558
580
|
return acc;
|
|
559
581
|
}, {}),
|
|
560
582
|
knownTestCaseIds: hasNoEnvironmentTestResults ? [] : filteredTestResults.map((tr) => tr.id),
|
|
@@ -589,7 +611,7 @@ export class DefaultAllureStore {
|
|
|
589
611
|
if (allHistoryDps.length === 0) {
|
|
590
612
|
return Array.from(__classPrivateFieldGet(this, _DefaultAllureStore_testResults, "f").values());
|
|
591
613
|
}
|
|
592
|
-
const
|
|
614
|
+
const lookup = __classPrivateFieldGet(this, _DefaultAllureStore_instances, "m", _DefaultAllureStore_getHistoryLookup).call(this);
|
|
593
615
|
const newTrs = [];
|
|
594
616
|
for (const [, tr] of __classPrivateFieldGet(this, _DefaultAllureStore_testResults, "f")) {
|
|
595
617
|
if (tr.isRetry) {
|
|
@@ -598,8 +620,7 @@ export class DefaultAllureStore {
|
|
|
598
620
|
if (typeof filter === "function" && !filter(tr)) {
|
|
599
621
|
continue;
|
|
600
622
|
}
|
|
601
|
-
|
|
602
|
-
if (historyIdCandidates.length === 0 || historyIdCandidates.every((historyId) => !historicalIds.has(historyId))) {
|
|
623
|
+
if (!allHistoryDps.some((point) => lookup(point, tr))) {
|
|
603
624
|
newTrs.push(tr);
|
|
604
625
|
}
|
|
605
626
|
}
|
|
@@ -793,26 +814,29 @@ export class DefaultAllureStore {
|
|
|
793
814
|
return options.includeRetries ? [...trs] : trs.filter((tr) => !tr.isRetry);
|
|
794
815
|
}
|
|
795
816
|
async allTestEnvGroups() {
|
|
796
|
-
const
|
|
817
|
+
const trByEnvironmentNeutralRetryHash = {};
|
|
797
818
|
for (const [, tr] of __classPrivateFieldGet(this, _DefaultAllureStore_testResults, "f")) {
|
|
798
|
-
const
|
|
799
|
-
|
|
819
|
+
const environmentNeutralRetryHash = calculateRetryHash({
|
|
820
|
+
testCaseHash: tr?.testCaseHash,
|
|
821
|
+
parametersHash: tr?.parametersHash,
|
|
822
|
+
});
|
|
823
|
+
if (!environmentNeutralRetryHash) {
|
|
800
824
|
continue;
|
|
801
825
|
}
|
|
802
|
-
if (
|
|
803
|
-
|
|
826
|
+
if (trByEnvironmentNeutralRetryHash[environmentNeutralRetryHash]) {
|
|
827
|
+
trByEnvironmentNeutralRetryHash[environmentNeutralRetryHash].push(tr);
|
|
804
828
|
}
|
|
805
829
|
else {
|
|
806
|
-
|
|
830
|
+
trByEnvironmentNeutralRetryHash[environmentNeutralRetryHash] = [tr];
|
|
807
831
|
}
|
|
808
832
|
}
|
|
809
|
-
return Object.entries(
|
|
833
|
+
return Object.entries(trByEnvironmentNeutralRetryHash).reduce((acc, [environmentNeutralRetryHash, trs]) => {
|
|
810
834
|
if (trs.length === 0) {
|
|
811
835
|
return acc;
|
|
812
836
|
}
|
|
813
837
|
const { fullName, name } = trs[0];
|
|
814
838
|
const envGroup = {
|
|
815
|
-
id:
|
|
839
|
+
id: environmentNeutralRetryHash,
|
|
816
840
|
fullName,
|
|
817
841
|
name,
|
|
818
842
|
status: getWorstStatus(trs.map(({ status }) => status)) ?? "passed",
|
|
@@ -867,11 +891,12 @@ export class DefaultAllureStore {
|
|
|
867
891
|
fixtures: mapToObject(__classPrivateFieldGet(this, _DefaultAllureStore_fixtures, "f")),
|
|
868
892
|
environments: __classPrivateFieldGet(this, _DefaultAllureStore_environments, "f"),
|
|
869
893
|
reportVariables: __classPrivateFieldGet(this, _DefaultAllureStore_reportVariables, "f"),
|
|
894
|
+
metadata: mapToObject(__classPrivateFieldGet(this, _DefaultAllureStore_metadata, "f")),
|
|
870
895
|
globalAttachmentIds: [...__classPrivateFieldGet(this, _DefaultAllureStore_globalAttachmentIds, "f"), ...__classPrivateFieldGet(this, _DefaultAllureStore_processGlobalAttachmentIds, "f")],
|
|
871
896
|
globalErrors: [...__classPrivateFieldGet(this, _DefaultAllureStore_globalErrors, "f"), ...__classPrivateFieldGet(this, _DefaultAllureStore_processGlobalErrors, "f")],
|
|
872
897
|
checkResults: mapToObject(__classPrivateFieldGet(this, _DefaultAllureStore_checkResultsById, "f")),
|
|
873
898
|
indexAttachmentByTestResult: {},
|
|
874
|
-
|
|
899
|
+
indexTestResultByRetryHash: {},
|
|
875
900
|
indexTestResultByTestCase: {},
|
|
876
901
|
indexTestResultByResolutionIssue: {},
|
|
877
902
|
indexAttachmentByFixture: {},
|
|
@@ -887,8 +912,8 @@ export class DefaultAllureStore {
|
|
|
887
912
|
this.indexAttachmentByTestResult.forEach((links, trId) => {
|
|
888
913
|
storeDump.indexAttachmentByTestResult[trId] = links.map((l) => l.id);
|
|
889
914
|
});
|
|
890
|
-
this.
|
|
891
|
-
storeDump.
|
|
915
|
+
this.indexTestResultByRetryHash.forEach((trs, retryHash) => {
|
|
916
|
+
storeDump.indexTestResultByRetryHash[retryHash] = trs.map((tr) => tr.id);
|
|
892
917
|
});
|
|
893
918
|
this.indexTestResultByTestCase.forEach((trs, tcId) => {
|
|
894
919
|
storeDump.indexTestResultByTestCase[tcId] = trs.map((tr) => tr.id);
|
|
@@ -902,22 +927,15 @@ export class DefaultAllureStore {
|
|
|
902
927
|
return storeDump;
|
|
903
928
|
}
|
|
904
929
|
async restoreState(stateDump, attachmentsContents = {}) {
|
|
905
|
-
|
|
906
|
-
const
|
|
907
|
-
|
|
908
|
-
|
|
909
|
-
|
|
910
|
-
|
|
911
|
-
|
|
912
|
-
|
|
913
|
-
|
|
914
|
-
return [
|
|
915
|
-
{
|
|
916
|
-
id: idValidation.normalized,
|
|
917
|
-
name: environmentValue.name ?? idValidation.normalized,
|
|
918
|
-
},
|
|
919
|
-
];
|
|
920
|
-
});
|
|
930
|
+
__classPrivateFieldSet(this, _DefaultAllureStore_historyLookup, undefined, "f");
|
|
931
|
+
const { testResults, attachments, testCases, fixtures, reportVariables, metadata = {}, environments, globalAttachmentIds = [], globalErrors = [], checkResults, indexAttachmentByTestResult = {}, indexAttachmentByFixture = {}, indexFixturesByTestResult = {}, qualityGateResults = [], metrics = [], testResultIdsIngestOrder = [], } = stateDump;
|
|
932
|
+
__classPrivateFieldGet(this, _DefaultAllureStore_resolutionIssues, "f").clear();
|
|
933
|
+
__classPrivateFieldGet(this, _DefaultAllureStore_testResultIdsByResolutionIssueId, "f").clear();
|
|
934
|
+
__classPrivateFieldGet(this, _DefaultAllureStore_resolutionIssueIdByTestResultId, "f").clear();
|
|
935
|
+
for (const testResult of __classPrivateFieldGet(this, _DefaultAllureStore_testResults, "f").values()) {
|
|
936
|
+
delete testResult.resolution;
|
|
937
|
+
delete testResult.resolutionComment;
|
|
938
|
+
}
|
|
921
939
|
const normalizedEnvironments = environments
|
|
922
940
|
.map((environmentValue) => {
|
|
923
941
|
if (typeof environmentValue === "string") {
|
|
@@ -945,41 +963,54 @@ export class DefaultAllureStore {
|
|
|
945
963
|
fallbackToMatch: false,
|
|
946
964
|
});
|
|
947
965
|
});
|
|
948
|
-
__classPrivateFieldGet(this, _DefaultAllureStore_instances, "m", _DefaultAllureStore_addEnvironments).call(this,
|
|
949
|
-
|
|
950
|
-
|
|
951
|
-
|
|
952
|
-
|
|
953
|
-
|
|
966
|
+
__classPrivateFieldGet(this, _DefaultAllureStore_instances, "m", _DefaultAllureStore_addEnvironments).call(this, normalizedEnvironments);
|
|
967
|
+
Object.values(testCases).forEach((testCase) => {
|
|
968
|
+
const testCaseHash = calculateTestCaseHash(testCase.externalId, testCase.fullName);
|
|
969
|
+
if (!testCaseHash) {
|
|
970
|
+
return;
|
|
971
|
+
}
|
|
972
|
+
const existingTestCase = __classPrivateFieldGet(this, _DefaultAllureStore_testCases, "f").get(testCaseHash);
|
|
973
|
+
if (!existingTestCase) {
|
|
974
|
+
__classPrivateFieldGet(this, _DefaultAllureStore_testCases, "f").set(testCaseHash, {
|
|
975
|
+
...testCase,
|
|
976
|
+
id: testCaseHash,
|
|
977
|
+
allureId: testCase.allureId?.trim() || undefined,
|
|
978
|
+
});
|
|
979
|
+
}
|
|
980
|
+
else if (!existingTestCase.allureId?.trim()) {
|
|
981
|
+
existingTestCase.allureId = testCase.allureId?.trim() || undefined;
|
|
982
|
+
}
|
|
983
|
+
});
|
|
954
984
|
Object.values(testResults).forEach((testResult) => {
|
|
955
985
|
__classPrivateFieldGet(this, _DefaultAllureStore_instances, "m", _DefaultAllureStore_removeResolutionIssueAssociation).call(this, testResult.id);
|
|
986
|
+
delete testResult.resolution;
|
|
987
|
+
delete testResult.resolutionComment;
|
|
956
988
|
__classPrivateFieldGet(this, _DefaultAllureStore_testResults, "f").set(testResult.id, testResult);
|
|
957
|
-
const
|
|
958
|
-
const envId = (storedEnvKey ? envNameToId.get(storedEnvKey) : undefined) ?? __classPrivateFieldGet(this, _DefaultAllureStore_instances, "m", _DefaultAllureStore_environmentIdByTestResult).call(this, testResult);
|
|
989
|
+
const envId = __classPrivateFieldGet(this, _DefaultAllureStore_instances, "m", _DefaultAllureStore_environmentIdByTestResult).call(this, testResult);
|
|
959
990
|
__classPrivateFieldGet(this, _DefaultAllureStore_instances, "m", _DefaultAllureStore_assertAllowedEnvironmentId).call(this, envId, `restored testResults[${JSON.stringify(testResult.id)}]`);
|
|
960
|
-
__classPrivateFieldGet(this, _DefaultAllureStore_instances, "m",
|
|
961
|
-
|
|
991
|
+
__classPrivateFieldGet(this, _DefaultAllureStore_instances, "m", _DefaultAllureStore_assignIdentityHashes).call(this, testResult, { environmentId: envId });
|
|
992
|
+
if (!testResult.testCaseHash) {
|
|
993
|
+
testResult.testCase = undefined;
|
|
994
|
+
}
|
|
995
|
+
else if (testResult.testCase) {
|
|
996
|
+
const restoredTestCase = __classPrivateFieldGet(this, _DefaultAllureStore_testCases, "f").get(testResult.testCaseHash);
|
|
997
|
+
if (restoredTestCase) {
|
|
998
|
+
if (!restoredTestCase.allureId?.trim()) {
|
|
999
|
+
restoredTestCase.allureId = testResult.testCase.allureId?.trim() || undefined;
|
|
1000
|
+
}
|
|
1001
|
+
testResult.testCase = restoredTestCase;
|
|
1002
|
+
}
|
|
1003
|
+
else {
|
|
1004
|
+
testResult.testCase.id = testResult.testCaseHash;
|
|
1005
|
+
testResult.testCase.allureId = testResult.testCase.allureId?.trim() || undefined;
|
|
1006
|
+
__classPrivateFieldGet(this, _DefaultAllureStore_testCases, "f").set(testResult.testCaseHash, testResult.testCase);
|
|
1007
|
+
}
|
|
1008
|
+
}
|
|
962
1009
|
});
|
|
963
1010
|
__classPrivateFieldGet(this, _DefaultAllureStore_retrySubstore, "f").restoreIngestOrder(testResultIdsIngestOrder, (id) => __classPrivateFieldGet(this, _DefaultAllureStore_testResults, "f").has(id));
|
|
964
|
-
this.indexTestResultByEnvironmentId.forEach((trs, envId) => {
|
|
965
|
-
__classPrivateFieldGet(this, _DefaultAllureStore_testResultIdsByEnvironmentId, "f").set(envId, new Set(trs.map((tr) => tr.id)));
|
|
966
|
-
});
|
|
967
1011
|
updateMapWithRecord(__classPrivateFieldGet(this, _DefaultAllureStore_checkResultsById, "f"), checkResults);
|
|
968
1012
|
updateMapWithRecord(__classPrivateFieldGet(this, _DefaultAllureStore_attachments, "f"), attachments);
|
|
969
|
-
updateMapWithRecord(__classPrivateFieldGet(this, _DefaultAllureStore_testCases, "f"), testCases);
|
|
970
1013
|
updateMapWithRecord(__classPrivateFieldGet(this, _DefaultAllureStore_fixtures, "f"), fixtures);
|
|
971
|
-
updateMapWithRecord(__classPrivateFieldGet(this, _DefaultAllureStore_resolutionIssues, "f"), resolutionIssues);
|
|
972
|
-
Object.entries(indexTestResultByResolutionIssue).forEach(([resolutionIssueId, testResultIds]) => {
|
|
973
|
-
const resolutionIssue = __classPrivateFieldGet(this, _DefaultAllureStore_resolutionIssues, "f").get(resolutionIssueId);
|
|
974
|
-
if (!resolutionIssue) {
|
|
975
|
-
return;
|
|
976
|
-
}
|
|
977
|
-
testResultIds.forEach((testResultId) => {
|
|
978
|
-
if (__classPrivateFieldGet(this, _DefaultAllureStore_testResults, "f").has(testResultId)) {
|
|
979
|
-
__classPrivateFieldGet(this, _DefaultAllureStore_instances, "m", _DefaultAllureStore_associateResolutionIssue).call(this, resolutionIssue, testResultId);
|
|
980
|
-
}
|
|
981
|
-
});
|
|
982
|
-
});
|
|
983
1014
|
Object.entries(attachmentsContents).forEach(([id, content]) => {
|
|
984
1015
|
__classPrivateFieldGet(this, _DefaultAllureStore_instances, "m", _DefaultAllureStore_restoreAttachmentContent).call(this, id, content);
|
|
985
1016
|
});
|
|
@@ -1008,6 +1039,7 @@ export class DefaultAllureStore {
|
|
|
1008
1039
|
__classPrivateFieldGet(this, _DefaultAllureStore_globalErrors, "f").push(__classPrivateFieldGet(this, _DefaultAllureStore_instances, "m", _DefaultAllureStore_indexGlobalError).call(this, error));
|
|
1009
1040
|
});
|
|
1010
1041
|
Object.assign(__classPrivateFieldGet(this, _DefaultAllureStore_reportVariables, "f"), reportVariables);
|
|
1042
|
+
updateMapWithRecord(__classPrivateFieldGet(this, _DefaultAllureStore_metadata, "f"), metadata);
|
|
1011
1043
|
Object.entries(indexAttachmentByTestResult).forEach(([trId, links]) => {
|
|
1012
1044
|
const attachmentsLinks = links.map((id) => __classPrivateFieldGet(this, _DefaultAllureStore_attachments, "f").get(id)).filter(Boolean);
|
|
1013
1045
|
if (attachmentsLinks.length === 0) {
|
|
@@ -1020,30 +1052,6 @@ export class DefaultAllureStore {
|
|
|
1020
1052
|
}
|
|
1021
1053
|
existingLinks.push(...attachmentsLinks);
|
|
1022
1054
|
});
|
|
1023
|
-
Object.entries(indexTestResultByHistoryId).forEach(([historyId, trIds]) => {
|
|
1024
|
-
const trs = trIds.map((id) => __classPrivateFieldGet(this, _DefaultAllureStore_testResults, "f").get(id)).filter(Boolean);
|
|
1025
|
-
if (trs.length === 0) {
|
|
1026
|
-
return;
|
|
1027
|
-
}
|
|
1028
|
-
const existingTrs = this.indexTestResultByHistoryId.get(historyId);
|
|
1029
|
-
if (!existingTrs) {
|
|
1030
|
-
this.indexTestResultByHistoryId.set(historyId, trs);
|
|
1031
|
-
return;
|
|
1032
|
-
}
|
|
1033
|
-
existingTrs.push(...trs);
|
|
1034
|
-
});
|
|
1035
|
-
Object.entries(indexTestResultByTestCase).forEach(([tcId, trIds]) => {
|
|
1036
|
-
const trs = trIds.map((id) => __classPrivateFieldGet(this, _DefaultAllureStore_testResults, "f").get(id)).filter(Boolean);
|
|
1037
|
-
if (trs.length === 0) {
|
|
1038
|
-
return;
|
|
1039
|
-
}
|
|
1040
|
-
const existingTrs = this.indexTestResultByTestCase.get(tcId);
|
|
1041
|
-
if (!existingTrs) {
|
|
1042
|
-
this.indexTestResultByTestCase.set(tcId, trs);
|
|
1043
|
-
return;
|
|
1044
|
-
}
|
|
1045
|
-
existingTrs.push(...trs);
|
|
1046
|
-
});
|
|
1047
1055
|
Object.entries(indexAttachmentByFixture).forEach(([fxId, attachmentIds]) => {
|
|
1048
1056
|
const attachmentsLinks = attachmentIds.map((id) => __classPrivateFieldGet(this, _DefaultAllureStore_attachments, "f").get(id)).filter(Boolean);
|
|
1049
1057
|
if (attachmentsLinks.length === 0) {
|
|
@@ -1068,6 +1076,8 @@ export class DefaultAllureStore {
|
|
|
1068
1076
|
}
|
|
1069
1077
|
existingFixtures.push(...fxs);
|
|
1070
1078
|
});
|
|
1079
|
+
__classPrivateFieldGet(this, _DefaultAllureStore_instances, "m", _DefaultAllureStore_rebuildIdentityIndexes).call(this);
|
|
1080
|
+
__classPrivateFieldGet(this, _DefaultAllureStore_instances, "m", _DefaultAllureStore_rebuildEnvironmentIndexes).call(this);
|
|
1071
1081
|
__classPrivateFieldGet(this, _DefaultAllureStore_instances, "m", _DefaultAllureStore_rebuildRetrySubstore).call(this);
|
|
1072
1082
|
for (const testResult of __classPrivateFieldGet(this, _DefaultAllureStore_testResults, "f").values()) {
|
|
1073
1083
|
__classPrivateFieldGet(this, _DefaultAllureStore_instances, "m", _DefaultAllureStore_classifyResolution).call(this, testResult);
|
|
@@ -1084,7 +1094,7 @@ export class DefaultAllureStore {
|
|
|
1084
1094
|
__classPrivateFieldGet(this, _DefaultAllureStore_metrics, "f").push(...metrics);
|
|
1085
1095
|
}
|
|
1086
1096
|
}
|
|
1087
|
-
_DefaultAllureStore_testResults = new WeakMap(),
|
|
1097
|
+
_DefaultAllureStore_testResults = new WeakMap(), _DefaultAllureStore_attachments = new WeakMap(), _DefaultAllureStore_attachmentContents = new WeakMap(), _DefaultAllureStore_testCases = new WeakMap(), _DefaultAllureStore_metadata = new WeakMap(), _DefaultAllureStore_history = new WeakMap(), _DefaultAllureStore_detectFlaky = 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_globalAttachmentIds = new WeakMap(), _DefaultAllureStore_globalAttachmentIdsByEnv = new WeakMap(), _DefaultAllureStore_globalErrors = new WeakMap(), _DefaultAllureStore_globalErrorsByEnv = new WeakMap(), _DefaultAllureStore_processGlobalAttachmentIds = new WeakMap(), _DefaultAllureStore_processGlobalAttachmentIdsByEnv = new WeakMap(), _DefaultAllureStore_processGlobalErrors = new WeakMap(), _DefaultAllureStore_processGlobalErrorsByEnv = 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_historyLookup = new WeakMap(), _DefaultAllureStore_environments = new WeakMap(), _DefaultAllureStore_instances = new WeakSet(), _DefaultAllureStore_mergeEnvironmentIdentity = function _DefaultAllureStore_mergeEnvironmentIdentity(existingEnvironment, incomingEnvironment) {
|
|
1088
1098
|
const configuredEnvironment = environmentIdentityById(__classPrivateFieldGet(this, _DefaultAllureStore_environmentsConfig, "f"), incomingEnvironment.id);
|
|
1089
1099
|
if (configuredEnvironment) {
|
|
1090
1100
|
return configuredEnvironment;
|
|
@@ -1110,12 +1120,12 @@ _DefaultAllureStore_testResults = new WeakMap(), _DefaultAllureStore_environment
|
|
|
1110
1120
|
name: incomingEnvironment.id,
|
|
1111
1121
|
};
|
|
1112
1122
|
}, _DefaultAllureStore_environmentIdForLookup = function _DefaultAllureStore_environmentIdForLookup(environmentKey) {
|
|
1113
|
-
const aliasedEnvironmentId = __classPrivateFieldGet(this, _DefaultAllureStore_instances, "m", _DefaultAllureStore_environmentIdByName).call(this, environmentKey);
|
|
1114
|
-
if (aliasedEnvironmentId) {
|
|
1115
|
-
return aliasedEnvironmentId;
|
|
1116
|
-
}
|
|
1117
1123
|
const environmentIdValidation = validateEnvironmentId(environmentKey);
|
|
1118
1124
|
return environmentIdValidation.valid ? environmentIdValidation.normalized : undefined;
|
|
1125
|
+
}, _DefaultAllureStore_environmentIdByName = function _DefaultAllureStore_environmentIdByName(environmentName) {
|
|
1126
|
+
return (__classPrivateFieldGet(this, _DefaultAllureStore_environments, "f").find(({ id }) => id === environmentName)?.id ??
|
|
1127
|
+
__classPrivateFieldGet(this, _DefaultAllureStore_environments, "f").find(({ name }) => name === environmentName)?.id ??
|
|
1128
|
+
__classPrivateFieldGet(this, _DefaultAllureStore_instances, "m", _DefaultAllureStore_environmentIdForLookup).call(this, environmentName));
|
|
1119
1129
|
}, _DefaultAllureStore_addEnvironments = function _DefaultAllureStore_addEnvironments(envs) {
|
|
1120
1130
|
if (__classPrivateFieldGet(this, _DefaultAllureStore_environments, "f").length === 0) {
|
|
1121
1131
|
__classPrivateFieldGet(this, _DefaultAllureStore_environments, "f").push(DEFAULT_ENVIRONMENT_IDENTITY);
|
|
@@ -1125,19 +1135,6 @@ _DefaultAllureStore_testResults = new WeakMap(), _DefaultAllureStore_environment
|
|
|
1125
1135
|
nextById.set(environment.id, __classPrivateFieldGet(this, _DefaultAllureStore_instances, "m", _DefaultAllureStore_mergeEnvironmentIdentity).call(this, nextById.get(environment.id), environment));
|
|
1126
1136
|
});
|
|
1127
1137
|
__classPrivateFieldSet(this, _DefaultAllureStore_environments, Array.from(nextById.values()), "f");
|
|
1128
|
-
__classPrivateFieldGet(this, _DefaultAllureStore_environmentNameToId, "f").clear();
|
|
1129
|
-
__classPrivateFieldGet(this, _DefaultAllureStore_environments, "f").forEach(({ id, name }) => {
|
|
1130
|
-
__classPrivateFieldGet(this, _DefaultAllureStore_environmentNameToId, "f").set(name, id);
|
|
1131
|
-
});
|
|
1132
|
-
envs.forEach(({ id, name }) => {
|
|
1133
|
-
__classPrivateFieldGet(this, _DefaultAllureStore_environmentDisplayNames, "f").set(name, id);
|
|
1134
|
-
});
|
|
1135
|
-
}, _DefaultAllureStore_environmentIdByName = function _DefaultAllureStore_environmentIdByName(environmentName) {
|
|
1136
|
-
const canonicalId = __classPrivateFieldGet(this, _DefaultAllureStore_environmentNameToId, "f").get(environmentName);
|
|
1137
|
-
if (canonicalId) {
|
|
1138
|
-
return canonicalId;
|
|
1139
|
-
}
|
|
1140
|
-
return __classPrivateFieldGet(this, _DefaultAllureStore_environmentDisplayNames, "f").get(environmentName);
|
|
1141
1138
|
}, _DefaultAllureStore_setTestResultEnvironmentId = function _DefaultAllureStore_setTestResultEnvironmentId(testResult, environmentId) {
|
|
1142
1139
|
if (!environmentId) {
|
|
1143
1140
|
return;
|
|
@@ -1174,18 +1171,21 @@ _DefaultAllureStore_testResults = new WeakMap(), _DefaultAllureStore_environment
|
|
|
1174
1171
|
}
|
|
1175
1172
|
__classPrivateFieldGet(this, _DefaultAllureStore_instances, "m", _DefaultAllureStore_assertAllowedEnvironmentId).call(this, environmentKey, sourcePath);
|
|
1176
1173
|
}, _DefaultAllureStore_environmentIdByTestResult = function _DefaultAllureStore_environmentIdByTestResult(testResult) {
|
|
1177
|
-
const
|
|
1178
|
-
|
|
1179
|
-
|
|
1180
|
-
|
|
1181
|
-
labels: testResult.labels,
|
|
1182
|
-
}, __classPrivateFieldGet(this, _DefaultAllureStore_environmentsConfig, "f"), {
|
|
1183
|
-
forcedEnvironment: __classPrivateFieldGet(this, _DefaultAllureStore_environment, "f"),
|
|
1184
|
-
})?.id);
|
|
1185
|
-
}, _DefaultAllureStore_assignRetryHash = function _DefaultAllureStore_assignRetryHash(testResult, options) {
|
|
1174
|
+
const environment = typeof testResult.environment === "string" ? testResult.environment : undefined;
|
|
1175
|
+
const validation = environment === undefined ? undefined : validateEnvironmentId(environment);
|
|
1176
|
+
return validation?.valid ? validation.normalized : undefined;
|
|
1177
|
+
}, _DefaultAllureStore_assignIdentityHashes = function _DefaultAllureStore_assignIdentityHashes(testResult, options) {
|
|
1186
1178
|
const environmentId = options?.environmentId ?? __classPrivateFieldGet(this, _DefaultAllureStore_instances, "m", _DefaultAllureStore_environmentIdByTestResult).call(this, testResult);
|
|
1187
|
-
const
|
|
1188
|
-
|
|
1179
|
+
const testCaseHash = calculateTestCaseHash(testResult.testCase?.externalId, testResult.fullName);
|
|
1180
|
+
const parametersHash = calculateParametersHash(testResult.parameters);
|
|
1181
|
+
const environmentHash = calculateEnvironmentHash(environmentId && environmentId !== DEFAULT_ENVIRONMENT ? environmentId : undefined);
|
|
1182
|
+
testResult.testCaseHash = testCaseHash;
|
|
1183
|
+
testResult.parametersHash = parametersHash;
|
|
1184
|
+
testResult.environmentHash = environmentHash;
|
|
1185
|
+
testResult.retryHash = calculateRetryHash({ testCaseHash, parametersHash, environmentHash });
|
|
1186
|
+
if (testResult.testCase && testCaseHash) {
|
|
1187
|
+
testResult.testCase.id = testCaseHash;
|
|
1188
|
+
}
|
|
1189
1189
|
}, _DefaultAllureStore_classifyResolution = function _DefaultAllureStore_classifyResolution(testResult) {
|
|
1190
1190
|
const rule = getResolutionByRules(testResult, __classPrivateFieldGet(this, _DefaultAllureStore_resolutionsConfig, "f"));
|
|
1191
1191
|
if (!rule?.resolution) {
|
|
@@ -1221,10 +1221,23 @@ _DefaultAllureStore_testResults = new WeakMap(), _DefaultAllureStore_environment
|
|
|
1221
1221
|
__classPrivateFieldGet(this, _DefaultAllureStore_retrySubstore, "f").reset();
|
|
1222
1222
|
for (const [, testResult] of __classPrivateFieldGet(this, _DefaultAllureStore_testResults, "f")) {
|
|
1223
1223
|
if (!testResult.retryHash) {
|
|
1224
|
-
__classPrivateFieldGet(this, _DefaultAllureStore_instances, "m",
|
|
1224
|
+
__classPrivateFieldGet(this, _DefaultAllureStore_instances, "m", _DefaultAllureStore_assignIdentityHashes).call(this, testResult);
|
|
1225
1225
|
}
|
|
1226
1226
|
__classPrivateFieldGet(this, _DefaultAllureStore_retrySubstore, "f").upsert(testResult);
|
|
1227
1227
|
}
|
|
1228
|
+
}, _DefaultAllureStore_rebuildIdentityIndexes = function _DefaultAllureStore_rebuildIdentityIndexes() {
|
|
1229
|
+
this.indexTestResultByTestCase.clear();
|
|
1230
|
+
this.indexTestResultByRetryHash.clear();
|
|
1231
|
+
for (const testResult of __classPrivateFieldGet(this, _DefaultAllureStore_testResults, "f").values()) {
|
|
1232
|
+
index(this.indexTestResultByTestCase, testResult.testCase?.id, testResult);
|
|
1233
|
+
index(this.indexTestResultByRetryHash, testResult.retryHash, testResult);
|
|
1234
|
+
}
|
|
1235
|
+
}, _DefaultAllureStore_rebuildEnvironmentIndexes = function _DefaultAllureStore_rebuildEnvironmentIndexes() {
|
|
1236
|
+
__classPrivateFieldGet(this, _DefaultAllureStore_testResultIdsByEnvironmentId, "f").clear();
|
|
1237
|
+
this.indexTestResultByEnvironmentId.clear();
|
|
1238
|
+
for (const testResult of __classPrivateFieldGet(this, _DefaultAllureStore_testResults, "f").values()) {
|
|
1239
|
+
__classPrivateFieldGet(this, _DefaultAllureStore_instances, "m", _DefaultAllureStore_setTestResultEnvironmentId).call(this, testResult, __classPrivateFieldGet(this, _DefaultAllureStore_instances, "m", _DefaultAllureStore_environmentIdByTestResult).call(this, testResult));
|
|
1240
|
+
}
|
|
1228
1241
|
}, _DefaultAllureStore_resolveGlobalEnvironmentIdentity = function _DefaultAllureStore_resolveGlobalEnvironmentIdentity(environment) {
|
|
1229
1242
|
if (environment !== undefined) {
|
|
1230
1243
|
const resolvedEnvironment = resolveStoredEnvironmentIdentity({
|
|
@@ -1278,6 +1291,16 @@ _DefaultAllureStore_testResults = new WeakMap(), _DefaultAllureStore_environment
|
|
|
1278
1291
|
__classPrivateFieldGet(this, _DefaultAllureStore_processGlobalAttachmentIdsByEnv, "f").clear();
|
|
1279
1292
|
__classPrivateFieldGet(this, _DefaultAllureStore_processGlobalErrors, "f").length = 0;
|
|
1280
1293
|
__classPrivateFieldGet(this, _DefaultAllureStore_processGlobalErrorsByEnv, "f").clear();
|
|
1294
|
+
}, _DefaultAllureStore_getHistoryLookup = function _DefaultAllureStore_getHistoryLookup() {
|
|
1295
|
+
return (__classPrivateFieldSet(this, _DefaultAllureStore_historyLookup, __classPrivateFieldGet(this, _DefaultAllureStore_historyLookup, "f") ?? createHistoryTestResultLookup(__classPrivateFieldGet(this, _DefaultAllureStore_testResults, "f").values()), "f"));
|
|
1296
|
+
}, _DefaultAllureStore_historyFor = function _DefaultAllureStore_historyFor(result, lookup) {
|
|
1297
|
+
return __classPrivateFieldGet(this, _DefaultAllureStore_historyPoints, "f").flatMap((point) => {
|
|
1298
|
+
const historicalResult = lookup(point, result);
|
|
1299
|
+
return historicalResult ? [historicalResult] : [];
|
|
1300
|
+
});
|
|
1301
|
+
}, _DefaultAllureStore_applyHistoryFlags = function _DefaultAllureStore_applyHistoryFlags(result, history) {
|
|
1302
|
+
result.flaky = result.sourceMetadata?.reportedFlaky === true || __classPrivateFieldGet(this, _DefaultAllureStore_detectFlaky, "f").call(this, result, history);
|
|
1303
|
+
result.transition = getStatusTransition(result, history);
|
|
1281
1304
|
}, _DefaultAllureStore_restoreAttachmentContent = function _DefaultAllureStore_restoreAttachmentContent(id, content) {
|
|
1282
1305
|
const attachment = __classPrivateFieldGet(this, _DefaultAllureStore_attachments, "f").get(id);
|
|
1283
1306
|
__classPrivateFieldGet(this, _DefaultAllureStore_attachmentContents, "f").set(id, content);
|
|
@@ -1306,9 +1329,12 @@ _DefaultAllureStore_testResults = new WeakMap(), _DefaultAllureStore_environment
|
|
|
1306
1329
|
if (!__classPrivateFieldGet(this, _DefaultAllureStore_history, "f")) {
|
|
1307
1330
|
return undefined;
|
|
1308
1331
|
}
|
|
1309
|
-
|
|
1310
|
-
if (historyIdCandidates.length === 0) {
|
|
1332
|
+
if (!tr.retryHash) {
|
|
1311
1333
|
return [];
|
|
1312
1334
|
}
|
|
1313
|
-
|
|
1335
|
+
const lookup = __classPrivateFieldGet(this, _DefaultAllureStore_instances, "m", _DefaultAllureStore_getHistoryLookup).call(this);
|
|
1336
|
+
return __classPrivateFieldGet(this, _DefaultAllureStore_historyPoints, "f").flatMap((point) => {
|
|
1337
|
+
const historical = lookup(point, tr);
|
|
1338
|
+
return historical ? [historical] : [];
|
|
1339
|
+
});
|
|
1314
1340
|
};
|