@allurereport/core 3.0.0 → 3.0.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/api.d.ts +1 -2
- package/dist/config.d.ts +1 -0
- package/dist/config.js +3 -0
- package/dist/history.d.ts +5 -2
- package/dist/history.js +17 -6
- package/dist/report.js +16 -13
- package/package.json +18 -18
package/dist/api.d.ts
CHANGED
|
@@ -13,6 +13,7 @@ export interface FullConfig {
|
|
|
13
13
|
open: boolean;
|
|
14
14
|
port: string | undefined;
|
|
15
15
|
historyPath?: string;
|
|
16
|
+
historyLimit?: number;
|
|
16
17
|
knownIssuesPath: string;
|
|
17
18
|
defaultLabels?: DefaultLabelsConfig;
|
|
18
19
|
stage?: string;
|
|
@@ -27,8 +28,6 @@ export interface FullConfig {
|
|
|
27
28
|
realTime?: any;
|
|
28
29
|
qualityGate?: QualityGateConfig;
|
|
29
30
|
allureService?: {
|
|
30
|
-
url?: string;
|
|
31
|
-
project?: string;
|
|
32
31
|
accessToken?: string;
|
|
33
32
|
};
|
|
34
33
|
}
|
package/dist/config.d.ts
CHANGED
package/dist/config.js
CHANGED
|
@@ -52,6 +52,7 @@ export const validateConfig = (config) => {
|
|
|
52
52
|
"open",
|
|
53
53
|
"port",
|
|
54
54
|
"historyPath",
|
|
55
|
+
"historyLimit",
|
|
55
56
|
"knownIssuesPath",
|
|
56
57
|
"plugins",
|
|
57
58
|
"defaultLabels",
|
|
@@ -105,6 +106,7 @@ export const resolveConfig = async (config, override = {}) => {
|
|
|
105
106
|
const open = override.open ?? config.open ?? false;
|
|
106
107
|
const port = override.port ?? config.port ?? undefined;
|
|
107
108
|
const historyPath = override.historyPath ?? config.historyPath;
|
|
109
|
+
const historyLimit = override.historyLimit ?? config.historyLimit;
|
|
108
110
|
const appendHistory = config.appendHistory ?? true;
|
|
109
111
|
const knownIssuesPath = resolve(override.knownIssuesPath ?? config.knownIssuesPath ?? "./allure/known.json");
|
|
110
112
|
const output = resolve(override.output ?? config.output ?? "./allure-report");
|
|
@@ -129,6 +131,7 @@ export const resolveConfig = async (config, override = {}) => {
|
|
|
129
131
|
variables,
|
|
130
132
|
environments,
|
|
131
133
|
appendHistory,
|
|
134
|
+
historyLimit,
|
|
132
135
|
historyPath: historyPath ? resolve(historyPath) : undefined,
|
|
133
136
|
reportFiles: new FileSystemReportFiles(output),
|
|
134
137
|
plugins: pluginInstances,
|
package/dist/history.d.ts
CHANGED
|
@@ -2,8 +2,11 @@ import type { AllureHistory, HistoryDataPoint, TestCase, TestResult } from "@all
|
|
|
2
2
|
export declare const createHistory: (reportUuid: string, reportName: string | undefined, testCases: TestCase[], testResults: TestResult[], remoteUrl?: string) => HistoryDataPoint;
|
|
3
3
|
export declare const writeHistory: (historyPath: string, data: HistoryDataPoint) => Promise<void>;
|
|
4
4
|
export declare class AllureLocalHistory implements AllureHistory {
|
|
5
|
-
private readonly
|
|
6
|
-
constructor(
|
|
5
|
+
private readonly params;
|
|
6
|
+
constructor(params: {
|
|
7
|
+
historyPath: string;
|
|
8
|
+
limit?: number;
|
|
9
|
+
});
|
|
7
10
|
readHistory(): Promise<HistoryDataPoint[]>;
|
|
8
11
|
appendHistory(data: HistoryDataPoint): Promise<void>;
|
|
9
12
|
}
|
package/dist/history.js
CHANGED
|
@@ -46,16 +46,20 @@ export const writeHistory = async (historyPath, data) => {
|
|
|
46
46
|
await writeFile(path, `${JSON.stringify(data)}\n`, { encoding: "utf-8", flag: "a+" });
|
|
47
47
|
};
|
|
48
48
|
export class AllureLocalHistory {
|
|
49
|
-
constructor(
|
|
50
|
-
this.
|
|
49
|
+
constructor(params) {
|
|
50
|
+
this.params = params;
|
|
51
51
|
}
|
|
52
52
|
async readHistory() {
|
|
53
|
-
const path = resolve(this.historyPath);
|
|
53
|
+
const path = resolve(this.params.historyPath);
|
|
54
54
|
try {
|
|
55
|
-
|
|
55
|
+
const historyPoints = (await readFile(path, { encoding: "utf-8" }))
|
|
56
56
|
.split("\n")
|
|
57
57
|
.filter((line) => line && line.trim() !== "")
|
|
58
58
|
.map((line) => JSON.parse(line));
|
|
59
|
+
if (this.params.limit) {
|
|
60
|
+
return historyPoints.slice(-this.params.limit);
|
|
61
|
+
}
|
|
62
|
+
return historyPoints;
|
|
59
63
|
}
|
|
60
64
|
catch (e) {
|
|
61
65
|
if (isFileNotFoundError(e)) {
|
|
@@ -65,9 +69,16 @@ export class AllureLocalHistory {
|
|
|
65
69
|
}
|
|
66
70
|
}
|
|
67
71
|
async appendHistory(data) {
|
|
68
|
-
const path = resolve(this.historyPath);
|
|
72
|
+
const path = resolve(this.params.historyPath);
|
|
69
73
|
const parentDir = dirname(path);
|
|
70
74
|
await mkdir(parentDir, { recursive: true });
|
|
71
|
-
|
|
75
|
+
if (!this.params.limit) {
|
|
76
|
+
await writeFile(path, `${JSON.stringify(data)}\n`, { encoding: "utf-8", flag: "a+" });
|
|
77
|
+
return;
|
|
78
|
+
}
|
|
79
|
+
const existingHistory = await this.readHistory();
|
|
80
|
+
const updatedHistory = [...existingHistory, data].slice(-this.params.limit);
|
|
81
|
+
const fileContent = updatedHistory.reduce((acc, point) => `${acc}${JSON.stringify(point)}\n`, "");
|
|
82
|
+
await writeFile(path, fileContent, "utf-8");
|
|
72
83
|
}
|
|
73
84
|
}
|
package/dist/report.js
CHANGED
|
@@ -508,8 +508,10 @@ export class AllureReport {
|
|
|
508
508
|
}
|
|
509
509
|
}
|
|
510
510
|
});
|
|
511
|
-
const { name, readers = [allure1, allure2, cucumberjson, junitXml, attachments], plugins = [], known, reportFiles, realTime, historyPath, defaultLabels = {}, variables = {}, environment, environments, output, qualityGate, stage, allureService: allureServiceConfig, } = opts;
|
|
512
|
-
__classPrivateFieldSet(this, _AllureReport_allureServiceClient, allureServiceConfig?.
|
|
511
|
+
const { name, readers = [allure1, allure2, cucumberjson, junitXml, attachments], plugins = [], known, reportFiles, realTime, historyPath, historyLimit, defaultLabels = {}, variables = {}, environment, environments, output, qualityGate, stage, allureService: allureServiceConfig, } = opts;
|
|
512
|
+
__classPrivateFieldSet(this, _AllureReport_allureServiceClient, allureServiceConfig?.accessToken
|
|
513
|
+
? new AllureServiceClient(allureServiceConfig)
|
|
514
|
+
: undefined, "f");
|
|
513
515
|
this.reportUuid = randomUUID();
|
|
514
516
|
__classPrivateFieldSet(this, _AllureReport_ci, detect(), "f");
|
|
515
517
|
const reportTitleSuffix = __classPrivateFieldGet(this, _AllureReport_ci, "f")?.pullRequestName ?? __classPrivateFieldGet(this, _AllureReport_ci, "f")?.jobRunName;
|
|
@@ -520,14 +522,21 @@ export class AllureReport {
|
|
|
520
522
|
__classPrivateFieldSet(this, _AllureReport_realtimeSubscriber, new RealtimeSubscriber(__classPrivateFieldGet(this, _AllureReport_eventEmitter, "f")), "f");
|
|
521
523
|
__classPrivateFieldSet(this, _AllureReport_realTime, realTime, "f");
|
|
522
524
|
__classPrivateFieldSet(this, _AllureReport_stage, stage, "f");
|
|
525
|
+
if (qualityGate) {
|
|
526
|
+
__classPrivateFieldSet(this, _AllureReport_qualityGate, new QualityGate(qualityGate), "f");
|
|
527
|
+
}
|
|
523
528
|
if (__classPrivateFieldGet(this, _AllureReport_allureServiceClient, "f")) {
|
|
524
|
-
__classPrivateFieldSet(this, _AllureReport_history, new AllureRemoteHistory(
|
|
529
|
+
__classPrivateFieldSet(this, _AllureReport_history, new AllureRemoteHistory({
|
|
530
|
+
allureServiceClient: __classPrivateFieldGet(this, _AllureReport_allureServiceClient, "f"),
|
|
531
|
+
branch: __classPrivateFieldGet(this, _AllureReport_ci, "f")?.jobRunBranch,
|
|
532
|
+
limit: historyLimit,
|
|
533
|
+
}), "f");
|
|
525
534
|
}
|
|
526
535
|
else if (historyPath) {
|
|
527
|
-
__classPrivateFieldSet(this, _AllureReport_history, new AllureLocalHistory(
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
536
|
+
__classPrivateFieldSet(this, _AllureReport_history, new AllureLocalHistory({
|
|
537
|
+
historyPath,
|
|
538
|
+
limit: historyLimit,
|
|
539
|
+
}), "f");
|
|
531
540
|
}
|
|
532
541
|
__classPrivateFieldSet(this, _AllureReport_store, new DefaultAllureStore({
|
|
533
542
|
realtimeSubscriber: __classPrivateFieldGet(this, _AllureReport_realtimeSubscriber, "f"),
|
|
@@ -543,12 +552,6 @@ export class AllureReport {
|
|
|
543
552
|
__classPrivateFieldSet(this, _AllureReport_plugins, [...plugins], "f");
|
|
544
553
|
__classPrivateFieldSet(this, _AllureReport_reportFiles, reportFiles, "f");
|
|
545
554
|
__classPrivateFieldSet(this, _AllureReport_output, output, "f");
|
|
546
|
-
if (__classPrivateFieldGet(this, _AllureReport_allureServiceClient, "f")) {
|
|
547
|
-
__classPrivateFieldSet(this, _AllureReport_history, new AllureRemoteHistory(__classPrivateFieldGet(this, _AllureReport_allureServiceClient, "f"), __classPrivateFieldGet(this, _AllureReport_ci, "f")?.jobRunBranch), "f");
|
|
548
|
-
}
|
|
549
|
-
else if (historyPath) {
|
|
550
|
-
__classPrivateFieldSet(this, _AllureReport_history, new AllureLocalHistory(historyPath), "f");
|
|
551
|
-
}
|
|
552
555
|
}
|
|
553
556
|
get hasQualityGate() {
|
|
554
557
|
return !!__classPrivateFieldGet(this, _AllureReport_qualityGate, "f");
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@allurereport/core",
|
|
3
|
-
"version": "3.0.
|
|
3
|
+
"version": "3.0.1",
|
|
4
4
|
"description": "Collection of generic Allure utilities used across the entire project",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"allure"
|
|
@@ -25,23 +25,23 @@
|
|
|
25
25
|
"test": "vitest run"
|
|
26
26
|
},
|
|
27
27
|
"dependencies": {
|
|
28
|
-
"@allurereport/ci": "3.0.
|
|
29
|
-
"@allurereport/core-api": "3.0.
|
|
30
|
-
"@allurereport/plugin-allure2": "3.0.
|
|
31
|
-
"@allurereport/plugin-api": "3.0.
|
|
32
|
-
"@allurereport/plugin-awesome": "3.0.
|
|
33
|
-
"@allurereport/plugin-classic": "3.0.
|
|
34
|
-
"@allurereport/plugin-csv": "3.0.
|
|
35
|
-
"@allurereport/plugin-dashboard": "3.0.
|
|
36
|
-
"@allurereport/plugin-jira": "3.0.
|
|
37
|
-
"@allurereport/plugin-log": "3.0.
|
|
38
|
-
"@allurereport/plugin-progress": "3.0.
|
|
39
|
-
"@allurereport/plugin-slack": "3.0.
|
|
40
|
-
"@allurereport/plugin-testplan": "3.0.
|
|
41
|
-
"@allurereport/reader": "3.0.
|
|
42
|
-
"@allurereport/reader-api": "3.0.
|
|
43
|
-
"@allurereport/service": "3.0.
|
|
44
|
-
"@allurereport/summary": "3.0.
|
|
28
|
+
"@allurereport/ci": "3.0.1",
|
|
29
|
+
"@allurereport/core-api": "3.0.1",
|
|
30
|
+
"@allurereport/plugin-allure2": "3.0.1",
|
|
31
|
+
"@allurereport/plugin-api": "3.0.1",
|
|
32
|
+
"@allurereport/plugin-awesome": "3.0.1",
|
|
33
|
+
"@allurereport/plugin-classic": "3.0.1",
|
|
34
|
+
"@allurereport/plugin-csv": "3.0.1",
|
|
35
|
+
"@allurereport/plugin-dashboard": "3.0.1",
|
|
36
|
+
"@allurereport/plugin-jira": "3.0.1",
|
|
37
|
+
"@allurereport/plugin-log": "3.0.1",
|
|
38
|
+
"@allurereport/plugin-progress": "3.0.1",
|
|
39
|
+
"@allurereport/plugin-slack": "3.0.1",
|
|
40
|
+
"@allurereport/plugin-testplan": "3.0.1",
|
|
41
|
+
"@allurereport/reader": "3.0.1",
|
|
42
|
+
"@allurereport/reader-api": "3.0.1",
|
|
43
|
+
"@allurereport/service": "3.0.1",
|
|
44
|
+
"@allurereport/summary": "3.0.1",
|
|
45
45
|
"handlebars": "^4.7.8",
|
|
46
46
|
"markdown-it": "^14.1.0",
|
|
47
47
|
"node-stream-zip": "^1.15.0",
|