@allurereport/core 3.8.2 → 3.9.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.
@@ -54,7 +54,7 @@ export const testResultRawToState = (stateData, raw, context) => {
54
54
  flaky: raw.flaky ?? false,
55
55
  muted: raw.muted ?? false,
56
56
  known: raw.known ?? false,
57
- hidden: false,
57
+ isRetry: false,
58
58
  labels,
59
59
  steps: convertSteps(stateData, raw.steps).convertedSteps,
60
60
  parameters,
@@ -0,0 +1,12 @@
1
+ import type { TestParameter, TestResult } from "@allurereport/core-api";
2
+ export declare const calculateParametersHash: (parameters?: TestParameter[]) => string;
3
+ export declare const calculateRetryHash: (testCaseId: string | undefined, parametersHash: string, environmentId: string | undefined) => string | undefined;
4
+ export declare class RetrySubstore {
5
+ #private;
6
+ recordIngestOrder(testResultId: string): void;
7
+ restoreIngestOrder(restoredIds: string[] | undefined, hasTestResult: (testResultId: string) => boolean): void;
8
+ ingestOrderIdsForDump(): string[];
9
+ upsert(testResult: TestResult): void;
10
+ retriesByTr(testResult: TestResult): TestResult[];
11
+ reset(): void;
12
+ }
@@ -0,0 +1,94 @@
1
+ var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) {
2
+ if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
3
+ 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");
4
+ return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
5
+ };
6
+ var _RetrySubstore_instances, _RetrySubstore_testResultsByRetryHash, _RetrySubstore_testResultIngestIndexById, _RetrySubstore_getIngestIndex, _RetrySubstore_compareResults;
7
+ import { md5 } from "../utils/crypto.js";
8
+ const NO_RETRIES = [];
9
+ const compareByNameThenValue = (first, second) => first.name.localeCompare(second.name) || first.value.localeCompare(second.value);
10
+ const stringifyRetryParameters = (parameters = []) => parameters
11
+ .filter((parameter) => !parameter.excluded)
12
+ .sort(compareByNameThenValue)
13
+ .map((parameter) => `${parameter.name}:${parameter.value}`)
14
+ .join(",");
15
+ export const calculateParametersHash = (parameters = []) => md5(stringifyRetryParameters(parameters));
16
+ export const calculateRetryHash = (testCaseId, parametersHash, environmentId) => {
17
+ if (!testCaseId) {
18
+ return undefined;
19
+ }
20
+ return md5(`${testCaseId}:${parametersHash}:${environmentId ?? "default"}`);
21
+ };
22
+ export class RetrySubstore {
23
+ constructor() {
24
+ _RetrySubstore_instances.add(this);
25
+ _RetrySubstore_testResultsByRetryHash.set(this, new Map());
26
+ _RetrySubstore_testResultIngestIndexById.set(this, new Map());
27
+ }
28
+ recordIngestOrder(testResultId) {
29
+ if (__classPrivateFieldGet(this, _RetrySubstore_testResultIngestIndexById, "f").has(testResultId)) {
30
+ return;
31
+ }
32
+ __classPrivateFieldGet(this, _RetrySubstore_testResultIngestIndexById, "f").set(testResultId, __classPrivateFieldGet(this, _RetrySubstore_testResultIngestIndexById, "f").size);
33
+ }
34
+ restoreIngestOrder(restoredIds, hasTestResult) {
35
+ __classPrivateFieldGet(this, _RetrySubstore_testResultIngestIndexById, "f").clear();
36
+ for (const id of restoredIds ?? []) {
37
+ if (!hasTestResult(id) || __classPrivateFieldGet(this, _RetrySubstore_testResultIngestIndexById, "f").has(id)) {
38
+ continue;
39
+ }
40
+ __classPrivateFieldGet(this, _RetrySubstore_testResultIngestIndexById, "f").set(id, __classPrivateFieldGet(this, _RetrySubstore_testResultIngestIndexById, "f").size);
41
+ }
42
+ }
43
+ ingestOrderIdsForDump() {
44
+ return Array.from(__classPrivateFieldGet(this, _RetrySubstore_testResultIngestIndexById, "f").keys());
45
+ }
46
+ upsert(testResult) {
47
+ testResult.isRetry = false;
48
+ if (!testResult.retryHash) {
49
+ return;
50
+ }
51
+ const results = __classPrivateFieldGet(this, _RetrySubstore_testResultsByRetryHash, "f").get(testResult.retryHash);
52
+ if (!results) {
53
+ __classPrivateFieldGet(this, _RetrySubstore_testResultsByRetryHash, "f").set(testResult.retryHash, [testResult]);
54
+ return;
55
+ }
56
+ results.push(testResult);
57
+ results.sort((first, second) => __classPrivateFieldGet(this, _RetrySubstore_instances, "m", _RetrySubstore_compareResults).call(this, first, second));
58
+ results.forEach((attempt, index) => {
59
+ attempt.isRetry = index !== 0;
60
+ });
61
+ }
62
+ retriesByTr(testResult) {
63
+ if (!testResult.retryHash || testResult.isRetry) {
64
+ return NO_RETRIES;
65
+ }
66
+ const attempts = __classPrivateFieldGet(this, _RetrySubstore_testResultsByRetryHash, "f").get(testResult.retryHash) ?? [];
67
+ const index = attempts.findIndex((attempt) => attempt.id === testResult.id);
68
+ if (index !== 0) {
69
+ return NO_RETRIES;
70
+ }
71
+ return attempts.slice(1);
72
+ }
73
+ reset() {
74
+ __classPrivateFieldGet(this, _RetrySubstore_testResultsByRetryHash, "f").clear();
75
+ }
76
+ }
77
+ _RetrySubstore_testResultsByRetryHash = new WeakMap(), _RetrySubstore_testResultIngestIndexById = new WeakMap(), _RetrySubstore_instances = new WeakSet(), _RetrySubstore_getIngestIndex = function _RetrySubstore_getIngestIndex(testResultId) {
78
+ return __classPrivateFieldGet(this, _RetrySubstore_testResultIngestIndexById, "f").get(testResultId) ?? -1;
79
+ }, _RetrySubstore_compareResults = function _RetrySubstore_compareResults(first, second) {
80
+ const firstHasStart = typeof first.start === "number";
81
+ const secondHasStart = typeof second.start === "number";
82
+ if (firstHasStart !== secondHasStart) {
83
+ return firstHasStart ? 1 : -1;
84
+ }
85
+ if (firstHasStart && secondHasStart && first.start !== second.start) {
86
+ return first.start > second.start ? -1 : 1;
87
+ }
88
+ const indexA = __classPrivateFieldGet(this, _RetrySubstore_instances, "m", _RetrySubstore_getIngestIndex).call(this, first.id);
89
+ const indexB = __classPrivateFieldGet(this, _RetrySubstore_instances, "m", _RetrySubstore_getIngestIndex).call(this, second.id);
90
+ if (indexA !== indexB) {
91
+ return indexA > indexB ? -1 : 1;
92
+ }
93
+ return 0;
94
+ };
@@ -7,7 +7,6 @@ export declare class DefaultAllureStore implements AllureStore, ResultsVisitor {
7
7
  #private;
8
8
  readonly indexTestResultByTestCase: Map<string, TestResult[]>;
9
9
  readonly indexTestResultByEnvironmentId: Map<string, TestResult[]>;
10
- readonly indexLatestEnvTestResultByHistoryId: Map<string, Map<string, TestResult>>;
11
10
  readonly indexTestResultByHistoryId: Map<string, TestResult[]>;
12
11
  readonly indexAttachmentByTestResult: Map<string, AttachmentLink[]>;
13
12
  readonly indexAttachmentByFixture: Map<string, AttachmentLink[]>;
@@ -44,7 +43,7 @@ export declare class DefaultAllureStore implements AllureStore, ResultsVisitor {
44
43
  visitGlobals(globals: RawGlobals): Promise<void>;
45
44
  allTestCases(): Promise<TestCase[]>;
46
45
  allTestResults(options?: {
47
- includeHidden?: boolean;
46
+ includeRetries?: boolean;
48
47
  filter?: TestResultFilter;
49
48
  }): Promise<TestResult[]>;
50
49
  allAttachments(options?: {
@@ -72,6 +71,12 @@ export declare class DefaultAllureStore implements AllureStore, ResultsVisitor {
72
71
  historyByTr(tr: TestResult): Promise<HistoryTestResult[] | undefined>;
73
72
  historyByTrId(trId: string): Promise<HistoryTestResult[] | undefined>;
74
73
  fixturesByTrId(trId: string): Promise<TestFixtureResult[]>;
74
+ relatedByTestResultIds(trIds: readonly string[]): Promise<{
75
+ attachmentsByTrId: Map<string, AttachmentLink[]>;
76
+ fixturesByTrId: Map<string, TestFixtureResult[]>;
77
+ historyByTrId: Map<string, HistoryTestResult[] | undefined>;
78
+ retriesByTrId: Map<string, TestResult[]>;
79
+ }>;
75
80
  failedTestResults(): Promise<TestResult[]>;
76
81
  unknownFailedTestResults(): Promise<TestResult[]>;
77
82
  testResultsByLabel(labelName: string): Promise<{
@@ -82,10 +87,10 @@ export declare class DefaultAllureStore implements AllureStore, ResultsVisitor {
82
87
  allEnvironments(): Promise<string[]>;
83
88
  allEnvironmentIdentities(): Promise<EnvironmentIdentity[]>;
84
89
  testResultsByEnvironment(env: string, options?: {
85
- includeHidden?: boolean;
90
+ includeRetries?: boolean;
86
91
  }): Promise<TestResult[]>;
87
92
  testResultsByEnvironmentId(envId: string, options?: {
88
- includeHidden?: boolean;
93
+ includeRetries?: boolean;
89
94
  }): Promise<TestResult[]>;
90
95
  allTestEnvGroups(): Promise<TestEnvGroup[]>;
91
96
  allVariables(): Promise<ReportVariables>;
@@ -9,14 +9,15 @@ 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, _DefaultAllureStore_known, _DefaultAllureStore_fixtures, _DefaultAllureStore_defaultLabels, _DefaultAllureStore_environment, _DefaultAllureStore_environmentsConfig, _DefaultAllureStore_reportVariables, _DefaultAllureStore_realtimeDispatcher, _DefaultAllureStore_realtimeSubscriber, _DefaultAllureStore_allowedEnvironmentIds, _DefaultAllureStore_globalAttachmentIds, _DefaultAllureStore_globalAttachmentIdsByEnv, _DefaultAllureStore_globalErrors, _DefaultAllureStore_globalErrorsByEnv, _DefaultAllureStore_globalExitCode, _DefaultAllureStore_checkResults, _DefaultAllureStore_qualityGateResults, _DefaultAllureStore_historyPoints, _DefaultAllureStore_environments, _DefaultAllureStore_mergeEnvironmentIdentity, _DefaultAllureStore_environmentIdForLookup, _DefaultAllureStore_addEnvironments, _DefaultAllureStore_environmentIdByName, _DefaultAllureStore_setTestResultEnvironmentId, _DefaultAllureStore_assertAllowedEnvironmentId, _DefaultAllureStore_assertAllowedStoredEnvironment, _DefaultAllureStore_environmentIdByTestResult, _DefaultAllureStore_resolveGlobalEnvironmentIdentity, _DefaultAllureStore_globalAttachmentId, _DefaultAllureStore_indexGlobalError, _DefaultAllureStore_addGlobalError, _DefaultAllureStore_indexGlobalAttachment, _DefaultAllureStore_addGlobalAttachment, _DefaultAllureStore_restoreAttachmentContent, _DefaultAllureStore_relinkRestoredAttachmentSteps;
12
+ var _DefaultAllureStore_instances, _DefaultAllureStore_testResults, _DefaultAllureStore_environmentDisplayNames, _DefaultAllureStore_environmentNameToId, _DefaultAllureStore_attachments, _DefaultAllureStore_attachmentContents, _DefaultAllureStore_testCases, _DefaultAllureStore_metadata, _DefaultAllureStore_history, _DefaultAllureStore_known, _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_checkResults, _DefaultAllureStore_qualityGateResults, _DefaultAllureStore_historyPoints, _DefaultAllureStore_environments, _DefaultAllureStore_mergeEnvironmentIdentity, _DefaultAllureStore_environmentIdForLookup, _DefaultAllureStore_addEnvironments, _DefaultAllureStore_environmentIdByName, _DefaultAllureStore_setTestResultEnvironmentId, _DefaultAllureStore_assertAllowedEnvironmentId, _DefaultAllureStore_assertAllowedStoredEnvironment, _DefaultAllureStore_environmentIdByTestResult, _DefaultAllureStore_assignRetryHash, _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, nullsLast, normalizeHistoryDataPoint, ordinal, reverse, selectHistoryTestResults, validateEnvironmentId, validateEnvironmentName, } from "@allurereport/core-api";
14
+ import { DEFAULT_ENVIRONMENT, DEFAULT_ENVIRONMENT_IDENTITY, compareBy, createDictionary, getHistoryIdCandidates, getWorstStatus, normalizeHistoryDataPoint, ordinal, reverse, selectHistoryTestResults, validateEnvironmentId, validateEnvironmentName, } from "@allurereport/core-api";
15
15
  import { md5, } from "@allurereport/plugin-api";
16
16
  import { environmentIdentityById, normalizeEnvironmentDescriptorMap, resolveEnvironmentIdentity, resolveStoredEnvironmentIdentity, validateAllowedEnvironmentId, } from "../utils/environment.js";
17
17
  import { isFlaky } from "../utils/flaky.js";
18
18
  import { getStatusTransition } from "../utils/new.js";
19
19
  import { testFixtureResultRawToState, testResultRawToState } from "./convert.js";
20
+ import { calculateParametersHash, calculateRetryHash, RetrySubstore } from "./retrySubstore.js";
20
21
  const index = (indexMap, key, ...items) => {
21
22
  if (key) {
22
23
  if (!indexMap.has(key)) {
@@ -26,31 +27,6 @@ const index = (indexMap, key, ...items) => {
26
27
  current.push(...items);
27
28
  }
28
29
  };
29
- const wasStartedEarlier = (first, second) => first.start === undefined || second.start === undefined || first.start < second.start;
30
- const hidePreviousAttemptByEnvironment = (state, testResult, environmentId) => {
31
- const { historyId } = testResult;
32
- if (environmentId) {
33
- if (!state.has(environmentId)) {
34
- state.set(environmentId, new Map());
35
- }
36
- if (historyId) {
37
- const historyIdToLastAttemptResult = state.get(environmentId);
38
- const currentLastAttemptResult = historyIdToLastAttemptResult.get(historyId);
39
- if (currentLastAttemptResult) {
40
- if (wasStartedEarlier(currentLastAttemptResult, testResult)) {
41
- historyIdToLastAttemptResult.set(historyId, testResult);
42
- currentLastAttemptResult.hidden = true;
43
- }
44
- else {
45
- testResult.hidden = true;
46
- }
47
- }
48
- else {
49
- historyIdToLastAttemptResult.set(historyId, testResult);
50
- }
51
- }
52
- }
53
- };
54
30
  export const mapToObject = (map) => {
55
31
  const result = {};
56
32
  map.forEach((value, key) => {
@@ -96,9 +72,11 @@ export class DefaultAllureStore {
96
72
  _DefaultAllureStore_realtimeDispatcher.set(this, void 0);
97
73
  _DefaultAllureStore_realtimeSubscriber.set(this, void 0);
98
74
  _DefaultAllureStore_allowedEnvironmentIds.set(this, void 0);
75
+ _DefaultAllureStore_retrySubstore.set(this, void 0);
76
+ _DefaultAllureStore_testResultIdsByEnvironmentId.set(this, new Map());
77
+ _DefaultAllureStore_cachedEnvironmentEntries.set(this, []);
99
78
  this.indexTestResultByTestCase = new Map();
100
79
  this.indexTestResultByEnvironmentId = new Map();
101
- this.indexLatestEnvTestResultByHistoryId = new Map();
102
80
  this.indexTestResultByHistoryId = new Map();
103
81
  this.indexAttachmentByTestResult = new Map();
104
82
  this.indexAttachmentByFixture = new Map();
@@ -147,6 +125,8 @@ export class DefaultAllureStore {
147
125
  __classPrivateFieldSet(this, _DefaultAllureStore_environment, resolvedEnvironment, "f");
148
126
  __classPrivateFieldSet(this, _DefaultAllureStore_reportVariables, reportVariables, "f");
149
127
  __classPrivateFieldSet(this, _DefaultAllureStore_allowedEnvironmentIds, new Set(allowedEnvironments ?? []), "f");
128
+ __classPrivateFieldSet(this, _DefaultAllureStore_retrySubstore, new RetrySubstore(), "f");
129
+ __classPrivateFieldSet(this, _DefaultAllureStore_cachedEnvironmentEntries, Object.entries(__classPrivateFieldGet(this, _DefaultAllureStore_environmentsConfig, "f")), "f");
150
130
  __classPrivateFieldGet(this, _DefaultAllureStore_instances, "m", _DefaultAllureStore_addEnvironments).call(this, environments);
151
131
  __classPrivateFieldGet(this, _DefaultAllureStore_realtimeSubscriber, "f")?.onQualityGateResults((results) => {
152
132
  __classPrivateFieldGet(this, _DefaultAllureStore_qualityGateResults, "f").push(...results);
@@ -323,7 +303,7 @@ export class DefaultAllureStore {
323
303
  }
324
304
  const environmentIdentity = __classPrivateFieldGet(this, _DefaultAllureStore_environment, "f") ??
325
305
  (() => {
326
- const match = Object.entries(__classPrivateFieldGet(this, _DefaultAllureStore_environmentsConfig, "f")).find(([, { matcher }]) => matcher({ labels: testResult.labels }));
306
+ const match = __classPrivateFieldGet(this, _DefaultAllureStore_cachedEnvironmentEntries, "f").find(([, { matcher }]) => matcher({ labels: testResult.labels }));
327
307
  if (!match) {
328
308
  return DEFAULT_ENVIRONMENT_IDENTITY;
329
309
  }
@@ -332,14 +312,19 @@ export class DefaultAllureStore {
332
312
  })();
333
313
  testResult.environment = environmentIdentity.name;
334
314
  __classPrivateFieldGet(this, _DefaultAllureStore_instances, "m", _DefaultAllureStore_addEnvironments).call(this, [environmentIdentity]);
335
- const trHistory = await this.historyByTr(testResult);
315
+ const parametersHash = typeof raw.parametersHash === "string" && raw.parametersHash.length > 0
316
+ ? raw.parametersHash
317
+ : calculateParametersHash(testResult.parameters);
318
+ testResult.retryHash = calculateRetryHash(testResult.testCase?.id, parametersHash, environmentIdentity.id);
319
+ const trHistory = __classPrivateFieldGet(this, _DefaultAllureStore_history, "f") ? await this.historyByTr(testResult) : undefined;
336
320
  if (trHistory !== undefined) {
337
321
  testResult.transition = getStatusTransition(testResult, trHistory);
338
322
  testResult.flaky = isFlaky(testResult, trHistory);
339
323
  }
340
324
  __classPrivateFieldGet(this, _DefaultAllureStore_testResults, "f").set(testResult.id, testResult);
341
325
  __classPrivateFieldGet(this, _DefaultAllureStore_instances, "m", _DefaultAllureStore_setTestResultEnvironmentId).call(this, testResult, environmentIdentity.id);
342
- hidePreviousAttemptByEnvironment(this.indexLatestEnvTestResultByHistoryId, testResult, environmentIdentity.id);
326
+ __classPrivateFieldGet(this, _DefaultAllureStore_retrySubstore, "f").recordIngestOrder(testResult.id);
327
+ __classPrivateFieldGet(this, _DefaultAllureStore_retrySubstore, "f").upsert(testResult);
343
328
  index(this.indexTestResultByTestCase, testResult.testCase?.id, testResult);
344
329
  index(this.indexTestResultByHistoryId, testResult.historyId, testResult);
345
330
  index(this.indexAttachmentByTestResult, testResult.id, ...attachmentLinks);
@@ -431,11 +416,11 @@ export class DefaultAllureStore {
431
416
  async allTestCases() {
432
417
  return Array.from(__classPrivateFieldGet(this, _DefaultAllureStore_testCases, "f").values());
433
418
  }
434
- async allTestResults(options = { includeHidden: false }) {
435
- const { includeHidden = false, filter } = options;
419
+ async allTestResults(options = { includeRetries: false }) {
420
+ const { includeRetries = false, filter } = options;
436
421
  const result = [];
437
422
  for (const [, tr] of __classPrivateFieldGet(this, _DefaultAllureStore_testResults, "f")) {
438
- if (!includeHidden && tr.hidden) {
423
+ if (!includeRetries && tr.isRetry) {
439
424
  continue;
440
425
  }
441
426
  if (typeof filter === "function" && !filter(tr)) {
@@ -531,7 +516,7 @@ export class DefaultAllureStore {
531
516
  const historicalIds = new Set(allHistoryDps.flatMap((dp) => Object.keys(dp.testResults ?? {})));
532
517
  const newTrs = [];
533
518
  for (const [, tr] of __classPrivateFieldGet(this, _DefaultAllureStore_testResults, "f")) {
534
- if (tr.hidden) {
519
+ if (tr.isRetry) {
535
520
  continue;
536
521
  }
537
522
  if (typeof filter === "function" && !filter(tr)) {
@@ -581,50 +566,48 @@ export class DefaultAllureStore {
581
566
  return this.indexAttachmentByTestResult.get(trId) ?? [];
582
567
  }
583
568
  async retriesByTr(tr) {
584
- const retries = [];
585
- if (!tr || tr.hidden || !tr.historyId) {
586
- return retries;
587
- }
588
- const trByHistoryId = this.indexTestResultByHistoryId.get(tr.historyId);
589
- if (!trByHistoryId) {
590
- return retries;
591
- }
592
- for (const r of trByHistoryId) {
593
- if (!r.hidden || tr.environment !== r.environment) {
594
- continue;
595
- }
596
- retries.push(r);
597
- }
598
- return retries.sort(nullsLast(compareBy("start", reverse(ordinal()))));
569
+ return __classPrivateFieldGet(this, _DefaultAllureStore_instances, "m", _DefaultAllureStore_retriesByTr).call(this, tr);
599
570
  }
600
571
  async retriesByTrId(trId) {
601
- const tr = await this.testResultById(trId);
602
- return this.retriesByTr(tr);
572
+ const tr = __classPrivateFieldGet(this, _DefaultAllureStore_testResults, "f").get(trId);
573
+ return __classPrivateFieldGet(this, _DefaultAllureStore_instances, "m", _DefaultAllureStore_retriesByTr).call(this, tr);
603
574
  }
604
575
  async historyByTr(tr) {
605
- if (!__classPrivateFieldGet(this, _DefaultAllureStore_history, "f")) {
606
- return undefined;
607
- }
608
- const historyIdCandidates = getHistoryIdCandidates(tr);
609
- if (historyIdCandidates.length === 0) {
610
- return [];
611
- }
612
- return selectHistoryTestResults(__classPrivateFieldGet(this, _DefaultAllureStore_historyPoints, "f"), historyIdCandidates);
576
+ return __classPrivateFieldGet(this, _DefaultAllureStore_instances, "m", _DefaultAllureStore_historyByTr).call(this, tr);
613
577
  }
614
578
  async historyByTrId(trId) {
615
- const tr = await this.testResultById(trId);
579
+ const tr = __classPrivateFieldGet(this, _DefaultAllureStore_testResults, "f").get(trId);
616
580
  if (!tr) {
617
581
  return undefined;
618
582
  }
619
- return this.historyByTr(tr);
583
+ return __classPrivateFieldGet(this, _DefaultAllureStore_instances, "m", _DefaultAllureStore_historyByTr).call(this, tr);
620
584
  }
621
585
  async fixturesByTrId(trId) {
622
586
  return this.indexFixturesByTestResult.get(trId) ?? [];
623
587
  }
588
+ async relatedByTestResultIds(trIds) {
589
+ const attachmentsByTrId = new Map();
590
+ const fixturesByTrId = new Map();
591
+ const historyByTrId = new Map();
592
+ const retriesByTrId = new Map();
593
+ for (const trId of trIds) {
594
+ const tr = __classPrivateFieldGet(this, _DefaultAllureStore_testResults, "f").get(trId);
595
+ attachmentsByTrId.set(trId, this.indexAttachmentByTestResult.get(trId) ?? []);
596
+ fixturesByTrId.set(trId, this.indexFixturesByTestResult.get(trId) ?? []);
597
+ retriesByTrId.set(trId, __classPrivateFieldGet(this, _DefaultAllureStore_instances, "m", _DefaultAllureStore_retriesByTr).call(this, tr));
598
+ historyByTrId.set(trId, tr ? __classPrivateFieldGet(this, _DefaultAllureStore_instances, "m", _DefaultAllureStore_historyByTr).call(this, tr) : undefined);
599
+ }
600
+ return {
601
+ attachmentsByTrId,
602
+ fixturesByTrId,
603
+ historyByTrId,
604
+ retriesByTrId,
605
+ };
606
+ }
624
607
  async failedTestResults() {
625
608
  const failedTrs = [];
626
609
  for (const [, tr] of __classPrivateFieldGet(this, _DefaultAllureStore_testResults, "f")) {
627
- if (tr.hidden) {
610
+ if (tr.isRetry) {
628
611
  continue;
629
612
  }
630
613
  if (tr.status === "failed" || tr.status === "broken") {
@@ -648,7 +631,7 @@ export class DefaultAllureStore {
648
631
  const results = createDictionary();
649
632
  results._ = [];
650
633
  for (const [, test] of __classPrivateFieldGet(this, _DefaultAllureStore_testResults, "f")) {
651
- if (test.hidden) {
634
+ if (test.isRetry) {
652
635
  continue;
653
636
  }
654
637
  const targetLabels = (test.labels ?? []).filter((label) => label.name === labelName);
@@ -668,14 +651,14 @@ export class DefaultAllureStore {
668
651
  async testsStatistic(filter) {
669
652
  const statistic = { total: 0 };
670
653
  for (const [, tr] of __classPrivateFieldGet(this, _DefaultAllureStore_testResults, "f")) {
671
- if (tr.hidden) {
654
+ if (tr.isRetry) {
672
655
  continue;
673
656
  }
674
657
  if (filter && !filter(tr)) {
675
658
  continue;
676
659
  }
677
660
  statistic.total++;
678
- const retries = await this.retriesByTr(tr);
661
+ const retries = __classPrivateFieldGet(this, _DefaultAllureStore_instances, "m", _DefaultAllureStore_retriesByTr).call(this, tr);
679
662
  if (retries.length > 0) {
680
663
  statistic.retries = (statistic.retries ?? 0) + 1;
681
664
  }
@@ -698,7 +681,7 @@ export class DefaultAllureStore {
698
681
  async allEnvironmentIdentities() {
699
682
  return __classPrivateFieldGet(this, _DefaultAllureStore_environments, "f");
700
683
  }
701
- async testResultsByEnvironment(env, options = { includeHidden: false }) {
684
+ async testResultsByEnvironment(env, options = { includeRetries: false }) {
702
685
  const environmentNameValidation = validateEnvironmentName(env);
703
686
  if (!environmentNameValidation.valid) {
704
687
  return [];
@@ -709,7 +692,7 @@ export class DefaultAllureStore {
709
692
  }
710
693
  return this.testResultsByEnvironmentId(environmentId, options);
711
694
  }
712
- async testResultsByEnvironmentId(envId, options = { includeHidden: false }) {
695
+ async testResultsByEnvironmentId(envId, options = { includeRetries: false }) {
713
696
  const normalizedEnvId = __classPrivateFieldGet(this, _DefaultAllureStore_instances, "m", _DefaultAllureStore_environmentIdForLookup).call(this, envId);
714
697
  if (!normalizedEnvId) {
715
698
  const validation = validateEnvironmentId(envId);
@@ -717,7 +700,7 @@ export class DefaultAllureStore {
717
700
  throw new Error(`Invalid environmentId ${JSON.stringify(envId)}: ${reason}`);
718
701
  }
719
702
  const trs = this.indexTestResultByEnvironmentId.get(normalizedEnvId) ?? [];
720
- return options.includeHidden ? [...trs] : trs.filter((tr) => !tr.hidden);
703
+ return options.includeRetries ? [...trs] : trs.filter((tr) => !tr.isRetry);
721
704
  }
722
705
  async allTestEnvGroups() {
723
706
  const trByTestCaseId = {};
@@ -800,7 +783,6 @@ export class DefaultAllureStore {
800
783
  ...result,
801
784
  ...(result.tags ? { tags: [...result.tags] } : {}),
802
785
  })),
803
- indexLatestEnvTestResultByHistoryId: {},
804
786
  indexAttachmentByTestResult: {},
805
787
  indexTestResultByHistoryId: {},
806
788
  indexTestResultByTestCase: {},
@@ -808,15 +790,8 @@ export class DefaultAllureStore {
808
790
  indexFixturesByTestResult: {},
809
791
  indexKnownByHistoryId: {},
810
792
  qualityGateResults: __classPrivateFieldGet(this, _DefaultAllureStore_qualityGateResults, "f"),
793
+ testResultIdsIngestOrder: __classPrivateFieldGet(this, _DefaultAllureStore_retrySubstore, "f").ingestOrderIdsForDump(),
811
794
  };
812
- this.indexLatestEnvTestResultByHistoryId.forEach((envMap, environmentId) => {
813
- if (!storeDump.indexLatestEnvTestResultByHistoryId[environmentId]) {
814
- storeDump.indexLatestEnvTestResultByHistoryId[environmentId] = {};
815
- }
816
- envMap.forEach((tr, historyId) => {
817
- storeDump.indexLatestEnvTestResultByHistoryId[environmentId][historyId] = tr.id;
818
- });
819
- });
820
795
  this.indexAttachmentByFixture.forEach((link, fxId) => {
821
796
  storeDump.indexAttachmentByFixture[fxId] = link.map((l) => l.id);
822
797
  });
@@ -838,7 +813,7 @@ export class DefaultAllureStore {
838
813
  return storeDump;
839
814
  }
840
815
  async restoreState(stateDump, attachmentsContents = {}) {
841
- const { testResults, attachments, testCases, fixtures, reportVariables, environments, globalAttachmentIds = [], globalErrors = [], checkResults = [], indexAttachmentByTestResult = {}, indexTestResultByHistoryId = {}, indexTestResultByTestCase = {}, indexLatestEnvTestResultByHistoryId = {}, indexAttachmentByFixture = {}, indexFixturesByTestResult = {}, indexKnownByHistoryId = {}, qualityGateResults = [], } = stateDump;
816
+ const { testResults, attachments, testCases, fixtures, reportVariables, environments, globalAttachmentIds = [], globalErrors = [], checkResults = [], indexAttachmentByTestResult = {}, indexTestResultByHistoryId = {}, indexTestResultByTestCase = {}, indexAttachmentByFixture = {}, indexFixturesByTestResult = {}, indexKnownByHistoryId = {}, qualityGateResults = [], testResultIdsIngestOrder = [], } = stateDump;
842
817
  const storedEnvironmentAliases = environments.flatMap((environmentValue) => {
843
818
  if (typeof environmentValue === "string") {
844
819
  return [{ id: environmentValue, name: environmentValue }];
@@ -893,6 +868,11 @@ export class DefaultAllureStore {
893
868
  const envId = (storedEnvKey ? envNameToId.get(storedEnvKey) : undefined) ?? __classPrivateFieldGet(this, _DefaultAllureStore_instances, "m", _DefaultAllureStore_environmentIdByTestResult).call(this, testResult);
894
869
  __classPrivateFieldGet(this, _DefaultAllureStore_instances, "m", _DefaultAllureStore_assertAllowedEnvironmentId).call(this, envId, `restored testResults[${JSON.stringify(testResult.id)}]`);
895
870
  __classPrivateFieldGet(this, _DefaultAllureStore_instances, "m", _DefaultAllureStore_setTestResultEnvironmentId).call(this, testResult, envId);
871
+ __classPrivateFieldGet(this, _DefaultAllureStore_instances, "m", _DefaultAllureStore_assignRetryHash).call(this, testResult, { environmentId: envId });
872
+ });
873
+ __classPrivateFieldGet(this, _DefaultAllureStore_retrySubstore, "f").restoreIngestOrder(testResultIdsIngestOrder, (id) => __classPrivateFieldGet(this, _DefaultAllureStore_testResults, "f").has(id));
874
+ this.indexTestResultByEnvironmentId.forEach((trs, envId) => {
875
+ __classPrivateFieldGet(this, _DefaultAllureStore_testResultIdsByEnvironmentId, "f").set(envId, new Set(trs.map((tr) => tr.id)));
896
876
  });
897
877
  updateMapWithRecord(__classPrivateFieldGet(this, _DefaultAllureStore_attachments, "f"), attachments);
898
878
  updateMapWithRecord(__classPrivateFieldGet(this, _DefaultAllureStore_testCases, "f"), testCases);
@@ -1005,56 +985,7 @@ export class DefaultAllureStore {
1005
985
  }
1006
986
  existingKnown.push(...knownFailures);
1007
987
  });
1008
- __classPrivateFieldGet(this, _DefaultAllureStore_environments, "f").forEach(({ id }) => {
1009
- if (!this.indexLatestEnvTestResultByHistoryId.has(id)) {
1010
- this.indexLatestEnvTestResultByHistoryId.set(id, new Map());
1011
- }
1012
- });
1013
- const latestAttemptsEntries = Object.entries(indexLatestEnvTestResultByHistoryId);
1014
- const hasNestedLatestAttempts = latestAttemptsEntries.some(([, value]) => typeof value === "object" && value !== null);
1015
- if (hasNestedLatestAttempts) {
1016
- latestAttemptsEntries.forEach(([environmentId, historyIds]) => {
1017
- const environmentIdValidation = validateEnvironmentId(environmentId);
1018
- if (!environmentIdValidation.valid || typeof historyIds !== "object" || historyIds === null) {
1019
- return;
1020
- }
1021
- const normalizedEnvironmentId = environmentIdValidation.normalized;
1022
- __classPrivateFieldGet(this, _DefaultAllureStore_instances, "m", _DefaultAllureStore_assertAllowedEnvironmentId).call(this, normalizedEnvironmentId, `restored indexLatestEnvTestResultByHistoryId[${JSON.stringify(environmentId)}]`);
1023
- Object.values(historyIds).forEach((trId) => {
1024
- const tr = __classPrivateFieldGet(this, _DefaultAllureStore_testResults, "f").get(trId);
1025
- if (!tr) {
1026
- return;
1027
- }
1028
- hidePreviousAttemptByEnvironment(this.indexLatestEnvTestResultByHistoryId, tr, normalizedEnvironmentId);
1029
- });
1030
- });
1031
- }
1032
- else {
1033
- Object.entries(indexLatestEnvTestResultByHistoryId).forEach(([historyId, latestTrId]) => {
1034
- const trIdsForHistory = indexTestResultByHistoryId[historyId] ?? [];
1035
- const storedLatestTr = __classPrivateFieldGet(this, _DefaultAllureStore_testResults, "f").get(latestTrId);
1036
- const storedLatestEnvironmentId = storedLatestTr
1037
- ? (__classPrivateFieldGet(this, _DefaultAllureStore_instances, "m", _DefaultAllureStore_environmentIdByTestResult).call(this, storedLatestTr) ?? DEFAULT_ENVIRONMENT)
1038
- : undefined;
1039
- if (storedLatestTr && storedLatestEnvironmentId) {
1040
- hidePreviousAttemptByEnvironment(this.indexLatestEnvTestResultByHistoryId, storedLatestTr, storedLatestEnvironmentId);
1041
- }
1042
- for (const trId of trIdsForHistory) {
1043
- if (trId === latestTrId) {
1044
- continue;
1045
- }
1046
- const tr = __classPrivateFieldGet(this, _DefaultAllureStore_testResults, "f").get(trId);
1047
- if (!tr) {
1048
- continue;
1049
- }
1050
- const environmentId = __classPrivateFieldGet(this, _DefaultAllureStore_instances, "m", _DefaultAllureStore_environmentIdByTestResult).call(this, tr) ?? DEFAULT_ENVIRONMENT;
1051
- if (storedLatestEnvironmentId && environmentId === storedLatestEnvironmentId) {
1052
- continue;
1053
- }
1054
- hidePreviousAttemptByEnvironment(this.indexLatestEnvTestResultByHistoryId, tr, environmentId);
1055
- }
1056
- });
1057
- }
988
+ __classPrivateFieldGet(this, _DefaultAllureStore_instances, "m", _DefaultAllureStore_rebuildRetrySubstore).call(this);
1058
989
  qualityGateResults.forEach((result, index) => {
1059
990
  __classPrivateFieldGet(this, _DefaultAllureStore_instances, "m", _DefaultAllureStore_assertAllowedStoredEnvironment).call(this, {
1060
991
  environment: result.environment,
@@ -1066,7 +997,7 @@ export class DefaultAllureStore {
1066
997
  });
1067
998
  }
1068
999
  }
1069
- _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_known = 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_globalAttachmentIds = new WeakMap(), _DefaultAllureStore_globalAttachmentIdsByEnv = new WeakMap(), _DefaultAllureStore_globalErrors = new WeakMap(), _DefaultAllureStore_globalErrorsByEnv = new WeakMap(), _DefaultAllureStore_globalExitCode = new WeakMap(), _DefaultAllureStore_checkResults = new WeakMap(), _DefaultAllureStore_qualityGateResults = new WeakMap(), _DefaultAllureStore_historyPoints = new WeakMap(), _DefaultAllureStore_environments = new WeakMap(), _DefaultAllureStore_instances = new WeakSet(), _DefaultAllureStore_mergeEnvironmentIdentity = function _DefaultAllureStore_mergeEnvironmentIdentity(existingEnvironment, incomingEnvironment) {
1000
+ _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_known = 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_checkResults = new WeakMap(), _DefaultAllureStore_qualityGateResults = new WeakMap(), _DefaultAllureStore_historyPoints = new WeakMap(), _DefaultAllureStore_environments = new WeakMap(), _DefaultAllureStore_instances = new WeakSet(), _DefaultAllureStore_mergeEnvironmentIdentity = function _DefaultAllureStore_mergeEnvironmentIdentity(existingEnvironment, incomingEnvironment) {
1070
1001
  const configuredEnvironment = environmentIdentityById(__classPrivateFieldGet(this, _DefaultAllureStore_environmentsConfig, "f"), incomingEnvironment.id);
1071
1002
  if (configuredEnvironment) {
1072
1003
  return configuredEnvironment;
@@ -1114,11 +1045,6 @@ _DefaultAllureStore_testResults = new WeakMap(), _DefaultAllureStore_environment
1114
1045
  envs.forEach(({ id, name }) => {
1115
1046
  __classPrivateFieldGet(this, _DefaultAllureStore_environmentDisplayNames, "f").set(name, id);
1116
1047
  });
1117
- envs.forEach(({ id }) => {
1118
- if (!this.indexLatestEnvTestResultByHistoryId.has(id)) {
1119
- this.indexLatestEnvTestResultByHistoryId.set(id, new Map());
1120
- }
1121
- });
1122
1048
  }, _DefaultAllureStore_environmentIdByName = function _DefaultAllureStore_environmentIdByName(environmentName) {
1123
1049
  const canonicalId = __classPrivateFieldGet(this, _DefaultAllureStore_environmentNameToId, "f").get(environmentName);
1124
1050
  if (canonicalId) {
@@ -1129,10 +1055,16 @@ _DefaultAllureStore_testResults = new WeakMap(), _DefaultAllureStore_environment
1129
1055
  if (!environmentId) {
1130
1056
  return;
1131
1057
  }
1132
- const existing = this.indexTestResultByEnvironmentId.get(environmentId);
1133
- if (existing?.some((tr) => tr.id === testResult.id)) {
1058
+ const ids = __classPrivateFieldGet(this, _DefaultAllureStore_testResultIdsByEnvironmentId, "f").get(environmentId);
1059
+ if (ids?.has(testResult.id)) {
1134
1060
  return;
1135
1061
  }
1062
+ if (!ids) {
1063
+ __classPrivateFieldGet(this, _DefaultAllureStore_testResultIdsByEnvironmentId, "f").set(environmentId, new Set([testResult.id]));
1064
+ }
1065
+ else {
1066
+ ids.add(testResult.id);
1067
+ }
1136
1068
  index(this.indexTestResultByEnvironmentId, environmentId, testResult);
1137
1069
  }, _DefaultAllureStore_assertAllowedEnvironmentId = function _DefaultAllureStore_assertAllowedEnvironmentId(environmentId, sourcePath) {
1138
1070
  if (!environmentId) {
@@ -1163,6 +1095,18 @@ _DefaultAllureStore_testResults = new WeakMap(), _DefaultAllureStore_environment
1163
1095
  }, __classPrivateFieldGet(this, _DefaultAllureStore_environmentsConfig, "f"), {
1164
1096
  forcedEnvironment: __classPrivateFieldGet(this, _DefaultAllureStore_environment, "f"),
1165
1097
  })?.id);
1098
+ }, _DefaultAllureStore_assignRetryHash = function _DefaultAllureStore_assignRetryHash(testResult, options) {
1099
+ const environmentId = options?.environmentId ?? __classPrivateFieldGet(this, _DefaultAllureStore_instances, "m", _DefaultAllureStore_environmentIdByTestResult).call(this, testResult);
1100
+ const parametersHash = options?.parametersHash ?? calculateParametersHash(testResult.parameters);
1101
+ testResult.retryHash = calculateRetryHash(testResult.testCase?.id, parametersHash, environmentId);
1102
+ }, _DefaultAllureStore_rebuildRetrySubstore = function _DefaultAllureStore_rebuildRetrySubstore() {
1103
+ __classPrivateFieldGet(this, _DefaultAllureStore_retrySubstore, "f").reset();
1104
+ for (const [, testResult] of __classPrivateFieldGet(this, _DefaultAllureStore_testResults, "f")) {
1105
+ if (!testResult.retryHash) {
1106
+ __classPrivateFieldGet(this, _DefaultAllureStore_instances, "m", _DefaultAllureStore_assignRetryHash).call(this, testResult);
1107
+ }
1108
+ __classPrivateFieldGet(this, _DefaultAllureStore_retrySubstore, "f").upsert(testResult);
1109
+ }
1166
1110
  }, _DefaultAllureStore_resolveGlobalEnvironmentIdentity = function _DefaultAllureStore_resolveGlobalEnvironmentIdentity(environment) {
1167
1111
  if (environment !== undefined) {
1168
1112
  const resolvedEnvironment = resolveStoredEnvironmentIdentity({
@@ -1227,4 +1171,18 @@ _DefaultAllureStore_testResults = new WeakMap(), _DefaultAllureStore_environment
1227
1171
  __classPrivateFieldGet(this, _DefaultAllureStore_fixtures, "f").forEach(({ steps }) => {
1228
1172
  relinkAttachmentSteps(steps, __classPrivateFieldGet(this, _DefaultAllureStore_attachments, "f"));
1229
1173
  });
1174
+ }, _DefaultAllureStore_retriesByTr = function _DefaultAllureStore_retriesByTr(tr) {
1175
+ if (!tr) {
1176
+ return [];
1177
+ }
1178
+ return __classPrivateFieldGet(this, _DefaultAllureStore_retrySubstore, "f").retriesByTr(tr);
1179
+ }, _DefaultAllureStore_historyByTr = function _DefaultAllureStore_historyByTr(tr) {
1180
+ if (!__classPrivateFieldGet(this, _DefaultAllureStore_history, "f")) {
1181
+ return undefined;
1182
+ }
1183
+ const historyIdCandidates = getHistoryIdCandidates(tr);
1184
+ if (historyIdCandidates.length === 0) {
1185
+ return [];
1186
+ }
1187
+ return selectHistoryTestResults(__classPrivateFieldGet(this, _DefaultAllureStore_historyPoints, "f"), historyIdCandidates);
1230
1188
  };
@@ -0,0 +1,4 @@
1
+ export declare const createUploadProgressBarCounter: (message: string, total: number) => {
2
+ tick: () => void;
3
+ terminate: () => void;
4
+ };