@allurereport/core-api 3.16.0 → 3.17.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/aggregate.d.ts +5 -0
- package/dist/config.d.ts +0 -1
- package/dist/index.d.ts +2 -1
- package/dist/index.js +1 -0
- package/dist/metrics.d.ts +32 -0
- package/dist/metrics.js +29 -0
- package/dist/model.d.ts +3 -1
- package/dist/resolutions.d.ts +48 -0
- package/dist/utils/history.d.ts +0 -1
- package/dist/utils/history.js +7 -10
- package/package.json +1 -1
- package/dist/known.d.ts +0 -20
- /package/dist/{known.js → resolutions.js} +0 -0
package/dist/aggregate.d.ts
CHANGED
package/dist/config.d.ts
CHANGED
package/dist/index.d.ts
CHANGED
|
@@ -4,8 +4,9 @@ export * from "./ci.js";
|
|
|
4
4
|
export * from "./gitFlow.js";
|
|
5
5
|
export type * from "./environment.js";
|
|
6
6
|
export type * from "./history.js";
|
|
7
|
-
export type * from "./
|
|
7
|
+
export type * from "./resolutions.js";
|
|
8
8
|
export type * from "./metadata.js";
|
|
9
|
+
export * from "./metrics.js";
|
|
9
10
|
export type * from "./model.js";
|
|
10
11
|
export type * from "./testCase.js";
|
|
11
12
|
export type * from "./testPlan.js";
|
package/dist/index.js
CHANGED
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
export type MetricBetter = "lower" | "higher" | "neutral";
|
|
2
|
+
export interface PerformanceGroupConfig {
|
|
3
|
+
title: string;
|
|
4
|
+
}
|
|
5
|
+
export interface PerformanceMetricConfig {
|
|
6
|
+
title: string;
|
|
7
|
+
unit: string;
|
|
8
|
+
better: Exclude<MetricBetter, "neutral">;
|
|
9
|
+
group?: string;
|
|
10
|
+
}
|
|
11
|
+
export interface PerformanceConfig {
|
|
12
|
+
groups?: Record<string, PerformanceGroupConfig>;
|
|
13
|
+
metrics?: Record<string, PerformanceMetricConfig>;
|
|
14
|
+
}
|
|
15
|
+
export interface AllurePerformanceResult {
|
|
16
|
+
id: string;
|
|
17
|
+
key: string;
|
|
18
|
+
value: any;
|
|
19
|
+
start: number;
|
|
20
|
+
stop: number;
|
|
21
|
+
}
|
|
22
|
+
export interface MetricSample extends AllurePerformanceResult {
|
|
23
|
+
value: number;
|
|
24
|
+
source?: string;
|
|
25
|
+
title?: string;
|
|
26
|
+
unit?: string;
|
|
27
|
+
group?: string;
|
|
28
|
+
groupTitle?: string;
|
|
29
|
+
better?: MetricBetter;
|
|
30
|
+
}
|
|
31
|
+
export type ResolvableMetric = AllurePerformanceResult & Partial<Pick<MetricSample, "source" | "title" | "unit" | "group" | "groupTitle" | "better">>;
|
|
32
|
+
export declare const resolveMetricSamples: (metrics: readonly ResolvableMetric[], performance?: PerformanceConfig) => MetricSample[];
|
package/dist/metrics.js
ADDED
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
const isValidMetricResult = (metric) => typeof metric.id === "string" &&
|
|
2
|
+
metric.id !== "" &&
|
|
3
|
+
typeof metric.key === "string" &&
|
|
4
|
+
metric.key !== "" &&
|
|
5
|
+
Number.isFinite(metric.start) &&
|
|
6
|
+
Number.isFinite(metric.stop);
|
|
7
|
+
export const resolveMetricSamples = (metrics, performance = {}) => {
|
|
8
|
+
const metricsConfig = performance.metrics ?? {};
|
|
9
|
+
const groupsConfig = performance.groups ?? {};
|
|
10
|
+
return metrics.reduce((acc, metric) => {
|
|
11
|
+
const value = Number.isFinite(metric.value) ? Number(metric.value) : undefined;
|
|
12
|
+
if (value === undefined || !isValidMetricResult(metric)) {
|
|
13
|
+
return acc;
|
|
14
|
+
}
|
|
15
|
+
const metricConfig = metricsConfig[metric.key];
|
|
16
|
+
const group = metricConfig?.group ?? metric.group;
|
|
17
|
+
const groupConfig = group ? groupsConfig[group] : undefined;
|
|
18
|
+
acc.push({
|
|
19
|
+
...metric,
|
|
20
|
+
value,
|
|
21
|
+
...(metricConfig?.title ? { title: metricConfig.title } : {}),
|
|
22
|
+
...(metricConfig?.unit ? { unit: metricConfig.unit } : {}),
|
|
23
|
+
...(group ? { group } : {}),
|
|
24
|
+
...(groupConfig?.title ? { groupTitle: groupConfig.title } : {}),
|
|
25
|
+
...(metricConfig?.better ? { better: metricConfig.better } : {}),
|
|
26
|
+
});
|
|
27
|
+
return acc;
|
|
28
|
+
}, []);
|
|
29
|
+
};
|
package/dist/model.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { TestLabel, TestLink, TestParameter } from "./metadata.js";
|
|
2
|
+
import type { ResolutionCategory } from "./resolutions.js";
|
|
2
3
|
import type { TestCase } from "./testCase.js";
|
|
3
4
|
export type TestStatus = "failed" | "broken" | "passed" | "skipped" | "unknown";
|
|
4
5
|
export type AllureCheckStatus = "passed" | "failed";
|
|
@@ -47,7 +48,8 @@ export interface TestResult {
|
|
|
47
48
|
duration?: number;
|
|
48
49
|
flaky: boolean;
|
|
49
50
|
muted: boolean;
|
|
50
|
-
|
|
51
|
+
resolution?: ResolutionCategory;
|
|
52
|
+
resolutionComment?: string;
|
|
51
53
|
transition?: TestStatusTransition;
|
|
52
54
|
retryHash?: string;
|
|
53
55
|
isRetry: boolean;
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import type { TestError, TestStatus } from "./model.js";
|
|
2
|
+
export type ResolutionCategory = "issue" | "muted" | "accepted";
|
|
3
|
+
export interface ResolutionLinkTemplate {
|
|
4
|
+
nameTemplate?: string;
|
|
5
|
+
urlTemplate: string;
|
|
6
|
+
}
|
|
7
|
+
export interface ResolutionMatcher {
|
|
8
|
+
messageRegexp?: string;
|
|
9
|
+
testCaseId?: string[];
|
|
10
|
+
retryHash?: string[];
|
|
11
|
+
environment?: string[];
|
|
12
|
+
}
|
|
13
|
+
export interface IssueResolutionRule extends ResolutionMatcher {
|
|
14
|
+
resolution: "issue";
|
|
15
|
+
issue: {
|
|
16
|
+
id: string;
|
|
17
|
+
type: string;
|
|
18
|
+
};
|
|
19
|
+
comment?: string;
|
|
20
|
+
}
|
|
21
|
+
export interface IgnoredResolutionRule extends ResolutionMatcher {
|
|
22
|
+
resolution: "muted" | "accepted";
|
|
23
|
+
comment: string;
|
|
24
|
+
}
|
|
25
|
+
export type ResolutionRule = IssueResolutionRule | IgnoredResolutionRule;
|
|
26
|
+
export interface ResolutionsConfig {
|
|
27
|
+
knownIssuesPath?: string;
|
|
28
|
+
links?: Record<string, ResolutionLinkTemplate>;
|
|
29
|
+
rules: ResolutionRule[];
|
|
30
|
+
}
|
|
31
|
+
export interface ResolutionIssue {
|
|
32
|
+
id: string;
|
|
33
|
+
type: string;
|
|
34
|
+
comment?: string;
|
|
35
|
+
}
|
|
36
|
+
export interface KnownIssueTestResult {
|
|
37
|
+
name: string;
|
|
38
|
+
fullName?: string;
|
|
39
|
+
environment?: string;
|
|
40
|
+
status: Extract<TestStatus, "failed" | "broken">;
|
|
41
|
+
error?: TestError;
|
|
42
|
+
}
|
|
43
|
+
export interface KnownIssueRecord extends ResolutionIssue {
|
|
44
|
+
testResults: Record<string, KnownIssueTestResult>;
|
|
45
|
+
}
|
|
46
|
+
export interface KnownIssuesFile {
|
|
47
|
+
resolutionIssues: KnownIssueRecord[];
|
|
48
|
+
}
|
package/dist/utils/history.d.ts
CHANGED
|
@@ -4,7 +4,6 @@ import type { TestResult } from "../model.js";
|
|
|
4
4
|
export declare const stringifyHistoryParams: (parameters?: TestParameter[]) => string;
|
|
5
5
|
export declare const getFallbackHistoryId: (tr: Pick<TestResult, "labels" | "parameters">) => string | undefined;
|
|
6
6
|
export declare const getHistoryIdCandidates: (tr: Pick<TestResult, "historyId" | "labels" | "parameters">) => string[];
|
|
7
|
-
export declare const filterUnknownByKnownIssues: (trs: TestResult[], knownIssueHistoryIds: ReadonlySet<string>) => TestResult[];
|
|
8
7
|
export declare const normalizeHistoryDataPoint: (historyDataPoint: HistoryDataPoint) => HistoryDataPoint;
|
|
9
8
|
export declare const normalizeHistoryDataPointUrls: (historyDataPoint: HistoryDataPoint) => HistoryDataPoint;
|
|
10
9
|
export declare const selectHistoryTestResults: (historyDataPoints: HistoryDataPoint[], historyIdCandidates: readonly string[]) => HistoryTestResult[];
|
package/dist/utils/history.js
CHANGED
|
@@ -9,6 +9,12 @@ const normalizeHistoryTestResults = (testResults) => {
|
|
|
9
9
|
}
|
|
10
10
|
return Object.fromEntries(Object.entries(testResults).filter(([, value]) => isRecord(value)));
|
|
11
11
|
};
|
|
12
|
+
const normalizeHistoryMetrics = (metrics) => {
|
|
13
|
+
if (!isRecord(metrics)) {
|
|
14
|
+
return {};
|
|
15
|
+
}
|
|
16
|
+
return Object.fromEntries(Object.entries(metrics).filter(([, value]) => Number.isFinite(value)));
|
|
17
|
+
};
|
|
12
18
|
const parametersCompare = (a, b) => {
|
|
13
19
|
return (a.name ?? "").localeCompare(b.name ?? "") || (a.value ?? "").localeCompare(b.value ?? "");
|
|
14
20
|
};
|
|
@@ -37,20 +43,11 @@ export const getHistoryIdCandidates = (tr) => {
|
|
|
37
43
|
}
|
|
38
44
|
return result;
|
|
39
45
|
};
|
|
40
|
-
export const filterUnknownByKnownIssues = (trs, knownIssueHistoryIds) => {
|
|
41
|
-
return trs.filter((tr) => {
|
|
42
|
-
const historyIdCandidates = getHistoryIdCandidates(tr);
|
|
43
|
-
if (historyIdCandidates.length === 0) {
|
|
44
|
-
return true;
|
|
45
|
-
}
|
|
46
|
-
return historyIdCandidates.every((historyId) => !knownIssueHistoryIds.has(historyId));
|
|
47
|
-
});
|
|
48
|
-
};
|
|
49
46
|
export const normalizeHistoryDataPoint = (historyDataPoint) => ({
|
|
50
47
|
...historyDataPoint,
|
|
51
48
|
knownTestCaseIds: Array.isArray(historyDataPoint.knownTestCaseIds) ? historyDataPoint.knownTestCaseIds : [],
|
|
52
49
|
testResults: normalizeHistoryTestResults(historyDataPoint.testResults),
|
|
53
|
-
metrics:
|
|
50
|
+
metrics: normalizeHistoryMetrics(historyDataPoint.metrics),
|
|
54
51
|
url: historyDataPoint.url ?? "",
|
|
55
52
|
});
|
|
56
53
|
export const normalizeHistoryDataPointUrls = (historyDataPoint) => {
|
package/package.json
CHANGED
package/dist/known.d.ts
DELETED
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import type { TestLink } from "./metadata.js";
|
|
2
|
-
import type { TestError } from "./model.js";
|
|
3
|
-
export interface KnownIssueDecision {
|
|
4
|
-
reason: string;
|
|
5
|
-
links?: TestLink[];
|
|
6
|
-
}
|
|
7
|
-
export interface KnownTestFailure extends KnownIssueDecision {
|
|
8
|
-
historyId: string;
|
|
9
|
-
error?: TestError;
|
|
10
|
-
}
|
|
11
|
-
export interface KnownIssueDescriptor {
|
|
12
|
-
messageRegexp?: string;
|
|
13
|
-
testCaseId?: string;
|
|
14
|
-
retryHash?: string;
|
|
15
|
-
environmentId?: string;
|
|
16
|
-
decision: KnownIssueDecision;
|
|
17
|
-
}
|
|
18
|
-
export interface KnownIssuesConfig {
|
|
19
|
-
rules: KnownIssueDescriptor[];
|
|
20
|
-
}
|
|
File without changes
|