@allurereport/core 3.0.0-beta.21 → 3.0.0-beta.22
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/report.js +35 -11
- package/dist/store/store.js +1 -1
- package/package.json +21 -18
package/dist/report.js
CHANGED
|
@@ -25,6 +25,8 @@ import { lstat, mkdtemp, opendir, readdir, realpath, rename, rm, writeFile } fro
|
|
|
25
25
|
import { tmpdir } from "node:os";
|
|
26
26
|
import { basename, dirname, join, resolve } from "node:path";
|
|
27
27
|
import { promisify } from "node:util";
|
|
28
|
+
import pLimit from "p-limit";
|
|
29
|
+
import ProgressBar from "progress";
|
|
28
30
|
import ZipWriteStream from "zip-stream";
|
|
29
31
|
import { AllureLocalHistory, createHistory } from "./history.js";
|
|
30
32
|
import { DefaultPluginState, PluginFiles } from "./plugin.js";
|
|
@@ -105,6 +107,7 @@ export class AllureReport {
|
|
|
105
107
|
});
|
|
106
108
|
};
|
|
107
109
|
this.start = async () => {
|
|
110
|
+
const repoData = await __classPrivateFieldGet(this, _AllureReport_store, "f").repoData();
|
|
108
111
|
await __classPrivateFieldGet(this, _AllureReport_store, "f").readHistory();
|
|
109
112
|
if (__classPrivateFieldGet(this, _AllureReport_executionStage, "f") === "running") {
|
|
110
113
|
throw new Error("the report is already started");
|
|
@@ -113,10 +116,11 @@ export class AllureReport {
|
|
|
113
116
|
throw new Error("the report is already stopped, the restart isn't supported at the moment");
|
|
114
117
|
}
|
|
115
118
|
__classPrivateFieldSet(this, _AllureReport_executionStage, "running", "f");
|
|
116
|
-
if (__classPrivateFieldGet(this, _AllureReport_allureServiceClient, "f") && __classPrivateFieldGet(this, _AllureReport_instances, "a", _AllureReport_publish_get)) {
|
|
119
|
+
if (__classPrivateFieldGet(this, _AllureReport_allureServiceClient, "f") && __classPrivateFieldGet(this, _AllureReport_instances, "a", _AllureReport_publish_get) && repoData?.branch) {
|
|
117
120
|
const { url } = await __classPrivateFieldGet(this, _AllureReport_allureServiceClient, "f").createReport({
|
|
118
121
|
reportUuid: this.reportUuid,
|
|
119
122
|
reportName: __classPrivateFieldGet(this, _AllureReport_reportName, "f"),
|
|
123
|
+
branch: repoData.branch,
|
|
120
124
|
});
|
|
121
125
|
this.reportUrl = url;
|
|
122
126
|
}
|
|
@@ -311,6 +315,9 @@ export class AllureReport {
|
|
|
311
315
|
if (__classPrivateFieldGet(this, _AllureReport_executionStage, "f") !== "running") {
|
|
312
316
|
throw new Error(initRequired);
|
|
313
317
|
}
|
|
318
|
+
const testResults = await __classPrivateFieldGet(this, _AllureReport_store, "f").allTestResults();
|
|
319
|
+
const testCases = await __classPrivateFieldGet(this, _AllureReport_store, "f").allTestCases();
|
|
320
|
+
const historyDataPoint = createHistory(this.reportUuid, __classPrivateFieldGet(this, _AllureReport_reportName, "f"), testCases, testResults, this.reportUrl);
|
|
314
321
|
__classPrivateFieldGet(this, _AllureReport_realtimeSubscriber, "f").offAll();
|
|
315
322
|
__classPrivateFieldSet(this, _AllureReport_executionStage, "done", "f");
|
|
316
323
|
if (__classPrivateFieldGet(this, _AllureReport_stage, "f")) {
|
|
@@ -319,10 +326,18 @@ export class AllureReport {
|
|
|
319
326
|
}
|
|
320
327
|
await __classPrivateFieldGet(this, _AllureReport_eachPlugin, "f").call(this, false, async (plugin, context) => {
|
|
321
328
|
await plugin.done?.(context, __classPrivateFieldGet(this, _AllureReport_store, "f"));
|
|
329
|
+
});
|
|
330
|
+
await __classPrivateFieldGet(this, _AllureReport_eachPlugin, "f").call(this, false, async (plugin, context) => {
|
|
322
331
|
if (__classPrivateFieldGet(this, _AllureReport_allureServiceClient, "f") && context.publish) {
|
|
323
332
|
const pluginFiles = (await context.state.get("files")) ?? {};
|
|
324
|
-
|
|
325
|
-
|
|
333
|
+
const pluginFilesEntries = Object.entries(pluginFiles);
|
|
334
|
+
const progressBar = new ProgressBar(`Publishing "${context.id}" report [:bar] :current/:total`, {
|
|
335
|
+
total: pluginFilesEntries.length,
|
|
336
|
+
width: 20,
|
|
337
|
+
});
|
|
338
|
+
const limitFn = pLimit(50);
|
|
339
|
+
const fns = pluginFilesEntries.map(([filename, filepath]) => limitFn(async () => {
|
|
340
|
+
if (/^(data|widgets|index\.html$|summary\.json$)/.test(filename)) {
|
|
326
341
|
await __classPrivateFieldGet(this, _AllureReport_allureServiceClient, "f").addReportFile({
|
|
327
342
|
reportUuid: this.reportUuid,
|
|
328
343
|
pluginId: context.id,
|
|
@@ -336,7 +351,10 @@ export class AllureReport {
|
|
|
336
351
|
filepath,
|
|
337
352
|
});
|
|
338
353
|
}
|
|
339
|
-
|
|
354
|
+
progressBar.tick();
|
|
355
|
+
}));
|
|
356
|
+
progressBar.render();
|
|
357
|
+
await Promise.all(fns);
|
|
340
358
|
}
|
|
341
359
|
const summary = await plugin?.info?.(context, __classPrivateFieldGet(this, _AllureReport_store, "f"));
|
|
342
360
|
if (!summary) {
|
|
@@ -344,7 +362,7 @@ export class AllureReport {
|
|
|
344
362
|
}
|
|
345
363
|
summary.pullRequestHref = __classPrivateFieldGet(this, _AllureReport_ci, "f")?.pullRequestUrl;
|
|
346
364
|
summary.jobHref = __classPrivateFieldGet(this, _AllureReport_ci, "f")?.jobRunUrl;
|
|
347
|
-
if (context.publish) {
|
|
365
|
+
if (context.publish && this.reportUrl) {
|
|
348
366
|
summary.remoteHref = `${this.reportUrl}/${context.id}/`;
|
|
349
367
|
remoteHrefs.push(summary.remoteHref);
|
|
350
368
|
}
|
|
@@ -354,9 +372,21 @@ export class AllureReport {
|
|
|
354
372
|
});
|
|
355
373
|
await context.reportFiles.addFile("summary.json", Buffer.from(JSON.stringify(summary)));
|
|
356
374
|
});
|
|
375
|
+
if (summaries.length > 1) {
|
|
376
|
+
const summaryPath = await generateSummary(__classPrivateFieldGet(this, _AllureReport_output, "f"), summaries);
|
|
377
|
+
const publishedReports = __classPrivateFieldGet(this, _AllureReport_plugins, "f").map((plugin) => !!plugin?.options?.publish).filter(Boolean);
|
|
378
|
+
if (__classPrivateFieldGet(this, _AllureReport_instances, "a", _AllureReport_publish_get) && summaryPath && publishedReports.length > 1) {
|
|
379
|
+
await __classPrivateFieldGet(this, _AllureReport_allureServiceClient, "f")?.addReportFile({
|
|
380
|
+
reportUuid: this.reportUuid,
|
|
381
|
+
filename: "index.html",
|
|
382
|
+
filepath: summaryPath,
|
|
383
|
+
});
|
|
384
|
+
}
|
|
385
|
+
}
|
|
357
386
|
if (__classPrivateFieldGet(this, _AllureReport_instances, "a", _AllureReport_publish_get)) {
|
|
358
387
|
await __classPrivateFieldGet(this, _AllureReport_allureServiceClient, "f")?.completeReport({
|
|
359
388
|
reportUuid: this.reportUuid,
|
|
389
|
+
historyPoint: historyDataPoint,
|
|
360
390
|
});
|
|
361
391
|
}
|
|
362
392
|
let outputDirFiles = [];
|
|
@@ -386,9 +416,6 @@ export class AllureReport {
|
|
|
386
416
|
catch (ignored) { }
|
|
387
417
|
}
|
|
388
418
|
if (__classPrivateFieldGet(this, _AllureReport_history, "f")) {
|
|
389
|
-
const testResults = await __classPrivateFieldGet(this, _AllureReport_store, "f").allTestResults();
|
|
390
|
-
const testCases = await __classPrivateFieldGet(this, _AllureReport_store, "f").allTestCases();
|
|
391
|
-
const historyDataPoint = createHistory(this.reportUuid, __classPrivateFieldGet(this, _AllureReport_reportName, "f"), testCases, testResults, this.reportUrl);
|
|
392
419
|
try {
|
|
393
420
|
await __classPrivateFieldGet(this, _AllureReport_store, "f").appendHistory(historyDataPoint);
|
|
394
421
|
}
|
|
@@ -404,9 +431,6 @@ export class AllureReport {
|
|
|
404
431
|
}
|
|
405
432
|
}
|
|
406
433
|
}
|
|
407
|
-
if (summaries.length > 1) {
|
|
408
|
-
await generateSummary(__classPrivateFieldGet(this, _AllureReport_output, "f"), summaries);
|
|
409
|
-
}
|
|
410
434
|
if (remoteHrefs.length > 0) {
|
|
411
435
|
console.info("Next reports have been published:");
|
|
412
436
|
remoteHrefs.forEach((href) => {
|
package/dist/store/store.js
CHANGED
|
@@ -144,7 +144,7 @@ export class DefaultAllureStore {
|
|
|
144
144
|
return [];
|
|
145
145
|
}
|
|
146
146
|
const repoData = await this.repoData();
|
|
147
|
-
__classPrivateFieldSet(this, _DefaultAllureStore_historyPoints, (await __classPrivateFieldGet(this, _DefaultAllureStore_history, "f").readHistory(repoData
|
|
147
|
+
__classPrivateFieldSet(this, _DefaultAllureStore_historyPoints, (await __classPrivateFieldGet(this, _DefaultAllureStore_history, "f").readHistory(repoData.branch)) ?? [], "f");
|
|
148
148
|
__classPrivateFieldGet(this, _DefaultAllureStore_historyPoints, "f").sort(compareBy("timestamp", reverse(ordinal())));
|
|
149
149
|
return __classPrivateFieldGet(this, _DefaultAllureStore_historyPoints, "f");
|
|
150
150
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@allurereport/core",
|
|
3
|
-
"version": "3.0.0-beta.
|
|
3
|
+
"version": "3.0.0-beta.22",
|
|
4
4
|
"description": "Collection of generic Allure utilities used across the entire project",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"allure"
|
|
@@ -25,26 +25,28 @@
|
|
|
25
25
|
"test": "vitest run"
|
|
26
26
|
},
|
|
27
27
|
"dependencies": {
|
|
28
|
-
"@allurereport/ci": "3.0.0-beta.
|
|
29
|
-
"@allurereport/core-api": "3.0.0-beta.
|
|
30
|
-
"@allurereport/plugin-allure2": "3.0.0-beta.
|
|
31
|
-
"@allurereport/plugin-api": "3.0.0-beta.
|
|
32
|
-
"@allurereport/plugin-awesome": "3.0.0-beta.
|
|
33
|
-
"@allurereport/plugin-classic": "3.0.0-beta.
|
|
34
|
-
"@allurereport/plugin-csv": "3.0.0-beta.
|
|
35
|
-
"@allurereport/plugin-dashboard": "3.0.0-beta.
|
|
36
|
-
"@allurereport/plugin-jira": "3.0.0-beta.
|
|
37
|
-
"@allurereport/plugin-log": "3.0.0-beta.
|
|
38
|
-
"@allurereport/plugin-progress": "3.0.0-beta.
|
|
39
|
-
"@allurereport/plugin-slack": "3.0.0-beta.
|
|
40
|
-
"@allurereport/plugin-testplan": "3.0.0-beta.
|
|
41
|
-
"@allurereport/reader": "3.0.0-beta.
|
|
42
|
-
"@allurereport/reader-api": "3.0.0-beta.
|
|
43
|
-
"@allurereport/service": "3.0.0-beta.
|
|
44
|
-
"@allurereport/summary": "3.0.0-beta.
|
|
28
|
+
"@allurereport/ci": "3.0.0-beta.22",
|
|
29
|
+
"@allurereport/core-api": "3.0.0-beta.22",
|
|
30
|
+
"@allurereport/plugin-allure2": "3.0.0-beta.22",
|
|
31
|
+
"@allurereport/plugin-api": "3.0.0-beta.22",
|
|
32
|
+
"@allurereport/plugin-awesome": "3.0.0-beta.22",
|
|
33
|
+
"@allurereport/plugin-classic": "3.0.0-beta.22",
|
|
34
|
+
"@allurereport/plugin-csv": "3.0.0-beta.22",
|
|
35
|
+
"@allurereport/plugin-dashboard": "3.0.0-beta.22",
|
|
36
|
+
"@allurereport/plugin-jira": "3.0.0-beta.22",
|
|
37
|
+
"@allurereport/plugin-log": "3.0.0-beta.22",
|
|
38
|
+
"@allurereport/plugin-progress": "3.0.0-beta.22",
|
|
39
|
+
"@allurereport/plugin-slack": "3.0.0-beta.22",
|
|
40
|
+
"@allurereport/plugin-testplan": "3.0.0-beta.22",
|
|
41
|
+
"@allurereport/reader": "3.0.0-beta.22",
|
|
42
|
+
"@allurereport/reader-api": "3.0.0-beta.22",
|
|
43
|
+
"@allurereport/service": "3.0.0-beta.22",
|
|
44
|
+
"@allurereport/summary": "3.0.0-beta.22",
|
|
45
45
|
"handlebars": "^4.7.8",
|
|
46
46
|
"markdown-it": "^14.1.0",
|
|
47
47
|
"node-stream-zip": "^1.15.0",
|
|
48
|
+
"p-limit": "^7.2.0",
|
|
49
|
+
"progress": "^2.0.3",
|
|
48
50
|
"yoctocolors": "^2.1.1",
|
|
49
51
|
"zip-stream": "^7.0.2"
|
|
50
52
|
},
|
|
@@ -54,6 +56,7 @@
|
|
|
54
56
|
"@types/handlebars": "^4.1.0",
|
|
55
57
|
"@types/markdown-it": "^14.1.2",
|
|
56
58
|
"@types/node": "^20.17.9",
|
|
59
|
+
"@types/progress": "^2",
|
|
57
60
|
"@types/zip-stream": "^7.0.0",
|
|
58
61
|
"@typescript-eslint/eslint-plugin": "^8.0.0",
|
|
59
62
|
"@typescript-eslint/parser": "^8.0.0",
|