@allurereport/core 3.6.2 → 3.7.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/config.js +1 -1
- package/dist/report.js +51 -17
- package/dist/store/convert.js +1 -0
- package/package.json +20 -20
package/dist/config.js
CHANGED
|
@@ -256,7 +256,7 @@ export const getPluginInstance = (config, predicate) => {
|
|
|
256
256
|
return config?.plugins?.find(predicate);
|
|
257
257
|
};
|
|
258
258
|
const isModuleNotFoundError = (err) => {
|
|
259
|
-
return err instanceof Error && "code" in err && err.code === "ERR_MODULE_NOT_FOUND";
|
|
259
|
+
return (err instanceof Error && "code" in err && (err.code === "ERR_MODULE_NOT_FOUND" || err.code === "MODULE_NOT_FOUND"));
|
|
260
260
|
};
|
|
261
261
|
export const resolvePlugin = async (path) => {
|
|
262
262
|
if (!path.startsWith("@allurereport/plugin-")) {
|
package/dist/report.js
CHANGED
|
@@ -23,7 +23,7 @@ import { normalizeCategoriesConfig } from "@allurereport/core-api";
|
|
|
23
23
|
import { AllureStoreDumpFiles, } from "@allurereport/plugin-api";
|
|
24
24
|
import { allure1, allure2, attachments, cucumberjson, junitXml, readXcResultBundle } from "@allurereport/reader";
|
|
25
25
|
import { PathResultFile } from "@allurereport/reader-api";
|
|
26
|
-
import { AllureRemoteHistory, AllureServiceClient, KnownError, UnknownError } from "@allurereport/service";
|
|
26
|
+
import { AllureLegacyServiceClient, AllureRemoteHistory, AllureServiceClient, KnownError, UnknownError, } from "@allurereport/service";
|
|
27
27
|
import { generateSummary } from "@allurereport/summary";
|
|
28
28
|
import { glob } from "glob";
|
|
29
29
|
import ZipReadStream from "node-stream-zip";
|
|
@@ -39,6 +39,11 @@ import { RealtimeEventsDispatcher, RealtimeSubscriber } from "./utils/event.js";
|
|
|
39
39
|
import { resolveDumpAttachmentPath, UnsafeDumpPathError } from "./utils/safeDumpPath.js";
|
|
40
40
|
const { version } = JSON.parse(readFileSync(new URL("../package.json", import.meta.url), "utf8"));
|
|
41
41
|
const initRequired = "report is not initialised. Call the start() method first.";
|
|
42
|
+
const remoteReportParams = (ci) => {
|
|
43
|
+
const repo = ci?.repoName;
|
|
44
|
+
const branch = ci?.jobRunBranch;
|
|
45
|
+
return repo && branch ? { repo, branch } : {};
|
|
46
|
+
};
|
|
42
47
|
export class AllureReport {
|
|
43
48
|
constructor(opts) {
|
|
44
49
|
_AllureReport_instances.add(this);
|
|
@@ -121,7 +126,7 @@ export class AllureReport {
|
|
|
121
126
|
});
|
|
122
127
|
};
|
|
123
128
|
this.start = async () => {
|
|
124
|
-
const
|
|
129
|
+
const remoteParams = remoteReportParams(__classPrivateFieldGet(this, _AllureReport_ci, "f"));
|
|
125
130
|
await __classPrivateFieldGet(this, _AllureReport_store, "f").readHistory();
|
|
126
131
|
if (__classPrivateFieldGet(this, _AllureReport_executionStage, "f") === "running") {
|
|
127
132
|
throw new Error("the report is already started");
|
|
@@ -148,13 +153,13 @@ export class AllureReport {
|
|
|
148
153
|
__classPrivateFieldGet(this, _AllureReport_realtimeDispatcher, "f").sendGlobalAttachment(new PathResultFile(absoluteFilePath, originalFileName), originalFileName);
|
|
149
154
|
}
|
|
150
155
|
}
|
|
151
|
-
if (__classPrivateFieldGet(this, _AllureReport_allureServiceClient, "f") && __classPrivateFieldGet(this, _AllureReport_instances, "a", _AllureReport_publish_get)
|
|
152
|
-
const
|
|
156
|
+
if (__classPrivateFieldGet(this, _AllureReport_allureServiceClient, "f") && __classPrivateFieldGet(this, _AllureReport_instances, "a", _AllureReport_publish_get)) {
|
|
157
|
+
const url = await __classPrivateFieldGet(this, _AllureReport_allureServiceClient, "f").createReport({
|
|
153
158
|
reportUuid: this.reportUuid,
|
|
154
159
|
reportName: __classPrivateFieldGet(this, _AllureReport_reportName, "f"),
|
|
155
|
-
|
|
160
|
+
...remoteParams,
|
|
156
161
|
});
|
|
157
|
-
this.reportUrl = url;
|
|
162
|
+
this.reportUrl = url.href;
|
|
158
163
|
}
|
|
159
164
|
await __classPrivateFieldGet(this, _AllureReport_eachPlugin, "f").call(this, true, async (plugin, context) => {
|
|
160
165
|
await plugin.start?.(context, __classPrivateFieldGet(this, _AllureReport_store, "f"), __classPrivateFieldGet(this, _AllureReport_realtimeSubscriber, "f"));
|
|
@@ -349,7 +354,8 @@ export class AllureReport {
|
|
|
349
354
|
};
|
|
350
355
|
this.done = async () => {
|
|
351
356
|
const summaries = [];
|
|
352
|
-
const remoteHrefs =
|
|
357
|
+
const remoteHrefs = new Set();
|
|
358
|
+
const remoteHrefsByPluginId = {};
|
|
353
359
|
const cancelledPluginsIds = new Set();
|
|
354
360
|
if (__classPrivateFieldGet(this, _AllureReport_executionStage, "f") !== "running") {
|
|
355
361
|
throw new Error(initRequired);
|
|
@@ -377,24 +383,37 @@ export class AllureReport {
|
|
|
377
383
|
})
|
|
378
384
|
: undefined;
|
|
379
385
|
const limitFn = pLimit(50);
|
|
386
|
+
const uploadAbortController = new AbortController();
|
|
380
387
|
const fns = pluginFilesEntries.map(([filename, filepath]) => limitFn(async () => {
|
|
381
|
-
if (cancelledPluginsIds.has(context.id)) {
|
|
388
|
+
if (cancelledPluginsIds.has(context.id) || uploadAbortController.signal.aborted) {
|
|
382
389
|
return;
|
|
383
390
|
}
|
|
384
391
|
if (/^(data|widgets|index\.html$|summary\.json$)/.test(filename)) {
|
|
385
|
-
await __classPrivateFieldGet(this, _AllureReport_allureServiceClient, "f").addReportFile({
|
|
392
|
+
const uploadedFileUrl = await __classPrivateFieldGet(this, _AllureReport_allureServiceClient, "f").addReportFile({
|
|
386
393
|
reportUuid: this.reportUuid,
|
|
387
394
|
pluginId: context.id,
|
|
388
395
|
filename,
|
|
389
396
|
filepath,
|
|
397
|
+
signal: uploadAbortController.signal,
|
|
390
398
|
});
|
|
399
|
+
if (cancelledPluginsIds.has(context.id) || uploadAbortController.signal.aborted) {
|
|
400
|
+
return;
|
|
401
|
+
}
|
|
402
|
+
if (filename === "index.html") {
|
|
403
|
+
remoteHrefsByPluginId[context.id] = uploadedFileUrl;
|
|
404
|
+
remoteHrefs.add(uploadedFileUrl);
|
|
405
|
+
}
|
|
391
406
|
}
|
|
392
407
|
else {
|
|
393
408
|
await __classPrivateFieldGet(this, _AllureReport_allureServiceClient, "f").addReportAsset({
|
|
394
409
|
filename,
|
|
395
410
|
filepath,
|
|
411
|
+
signal: uploadAbortController.signal,
|
|
396
412
|
});
|
|
397
413
|
}
|
|
414
|
+
if (cancelledPluginsIds.has(context.id) || uploadAbortController.signal.aborted) {
|
|
415
|
+
return;
|
|
416
|
+
}
|
|
398
417
|
progressBar?.tick?.();
|
|
399
418
|
}));
|
|
400
419
|
progressBar?.render?.();
|
|
@@ -403,6 +422,13 @@ export class AllureReport {
|
|
|
403
422
|
}
|
|
404
423
|
catch (err) {
|
|
405
424
|
cancelledPluginsIds.add(context.id);
|
|
425
|
+
uploadAbortController.abort();
|
|
426
|
+
await Promise.allSettled(fns);
|
|
427
|
+
const pluginRemoteHref = remoteHrefsByPluginId[context.id];
|
|
428
|
+
if (pluginRemoteHref) {
|
|
429
|
+
remoteHrefs.delete(pluginRemoteHref);
|
|
430
|
+
delete remoteHrefsByPluginId[context.id];
|
|
431
|
+
}
|
|
406
432
|
await __classPrivateFieldGet(this, _AllureReport_allureServiceClient, "f").deleteReport({
|
|
407
433
|
reportUuid: this.reportUuid,
|
|
408
434
|
pluginId: context.id,
|
|
@@ -418,9 +444,12 @@ export class AllureReport {
|
|
|
418
444
|
summary.pluginId = context.id;
|
|
419
445
|
summary.pullRequestHref = __classPrivateFieldGet(this, _AllureReport_ci, "f")?.pullRequestUrl;
|
|
420
446
|
summary.jobHref = __classPrivateFieldGet(this, _AllureReport_ci, "f")?.jobRunUrl;
|
|
421
|
-
if (context.publish &&
|
|
422
|
-
summary.remoteHref =
|
|
423
|
-
|
|
447
|
+
if (context.publish && !cancelledPluginsIds.has(context.id)) {
|
|
448
|
+
summary.remoteHref =
|
|
449
|
+
remoteHrefsByPluginId[context.id] ?? (this.reportUrl ? `${this.reportUrl}/${context.id}/` : undefined);
|
|
450
|
+
if (summary.remoteHref) {
|
|
451
|
+
remoteHrefs.add(summary.remoteHref);
|
|
452
|
+
}
|
|
424
453
|
}
|
|
425
454
|
summaries.push({
|
|
426
455
|
...summary,
|
|
@@ -490,7 +519,7 @@ export class AllureReport {
|
|
|
490
519
|
}
|
|
491
520
|
}
|
|
492
521
|
}
|
|
493
|
-
if (remoteHrefs.
|
|
522
|
+
if (remoteHrefs.size > 0) {
|
|
494
523
|
console.info("Next reports have been published:");
|
|
495
524
|
remoteHrefs.forEach((href) => {
|
|
496
525
|
console.info(`- ${href}`);
|
|
@@ -553,9 +582,14 @@ export class AllureReport {
|
|
|
553
582
|
}
|
|
554
583
|
});
|
|
555
584
|
const { name, readers = [allure1, allure2, cucumberjson, junitXml, attachments], plugins = [], known, reportFiles, realTime, historyPath, historyLimit, defaultLabels = {}, variables = {}, environment, allowedEnvironments, environments, output, hideLabels, qualityGate, dump, categories, allureService: allureServiceConfig, globalAttachments, } = opts;
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
585
|
+
if (allureServiceConfig?.accessToken) {
|
|
586
|
+
if (allureServiceConfig?.legacy) {
|
|
587
|
+
__classPrivateFieldSet(this, _AllureReport_allureServiceClient, new AllureLegacyServiceClient(allureServiceConfig), "f");
|
|
588
|
+
}
|
|
589
|
+
else if (allureServiceConfig?.url) {
|
|
590
|
+
__classPrivateFieldSet(this, _AllureReport_allureServiceClient, new AllureServiceClient(allureServiceConfig), "f");
|
|
591
|
+
}
|
|
592
|
+
}
|
|
559
593
|
this.reportUuid = randomUUID();
|
|
560
594
|
__classPrivateFieldSet(this, _AllureReport_ci, detect(), "f");
|
|
561
595
|
const reportTitleSuffix = __classPrivateFieldGet(this, _AllureReport_ci, "f")?.pullRequestName ?? __classPrivateFieldGet(this, _AllureReport_ci, "f")?.jobRunName;
|
|
@@ -576,7 +610,7 @@ export class AllureReport {
|
|
|
576
610
|
if (__classPrivateFieldGet(this, _AllureReport_allureServiceClient, "f")) {
|
|
577
611
|
__classPrivateFieldSet(this, _AllureReport_history, new AllureRemoteHistory({
|
|
578
612
|
limit: historyLimit,
|
|
579
|
-
|
|
613
|
+
...remoteReportParams(__classPrivateFieldGet(this, _AllureReport_ci, "f")),
|
|
580
614
|
allureServiceClient: __classPrivateFieldGet(this, _AllureReport_allureServiceClient, "f"),
|
|
581
615
|
}), "f");
|
|
582
616
|
}
|
package/dist/store/convert.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@allurereport/core",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.7.0",
|
|
4
4
|
"description": "Collection of generic Allure utilities used across the entire project",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"allure"
|
|
@@ -25,25 +25,25 @@
|
|
|
25
25
|
"lint:fix": "oxlint --import-plugin --fix src test features stories"
|
|
26
26
|
},
|
|
27
27
|
"dependencies": {
|
|
28
|
-
"@allurereport/ci": "3.
|
|
29
|
-
"@allurereport/core-api": "3.
|
|
30
|
-
"@allurereport/plugin-agent": "3.
|
|
31
|
-
"@allurereport/plugin-allure2": "3.
|
|
32
|
-
"@allurereport/plugin-api": "3.
|
|
33
|
-
"@allurereport/plugin-awesome": "3.
|
|
34
|
-
"@allurereport/plugin-classic": "3.
|
|
35
|
-
"@allurereport/plugin-csv": "3.
|
|
36
|
-
"@allurereport/plugin-dashboard": "3.
|
|
37
|
-
"@allurereport/plugin-jira": "3.
|
|
38
|
-
"@allurereport/plugin-log": "3.
|
|
39
|
-
"@allurereport/plugin-progress": "3.
|
|
40
|
-
"@allurereport/plugin-slack": "3.
|
|
41
|
-
"@allurereport/plugin-testops": "3.
|
|
42
|
-
"@allurereport/plugin-testplan": "3.
|
|
43
|
-
"@allurereport/reader": "3.
|
|
44
|
-
"@allurereport/reader-api": "3.
|
|
45
|
-
"@allurereport/service": "3.
|
|
46
|
-
"@allurereport/summary": "3.
|
|
28
|
+
"@allurereport/ci": "3.7.0",
|
|
29
|
+
"@allurereport/core-api": "3.7.0",
|
|
30
|
+
"@allurereport/plugin-agent": "3.7.0",
|
|
31
|
+
"@allurereport/plugin-allure2": "3.7.0",
|
|
32
|
+
"@allurereport/plugin-api": "3.7.0",
|
|
33
|
+
"@allurereport/plugin-awesome": "3.7.0",
|
|
34
|
+
"@allurereport/plugin-classic": "3.7.0",
|
|
35
|
+
"@allurereport/plugin-csv": "3.7.0",
|
|
36
|
+
"@allurereport/plugin-dashboard": "3.7.0",
|
|
37
|
+
"@allurereport/plugin-jira": "3.7.0",
|
|
38
|
+
"@allurereport/plugin-log": "3.7.0",
|
|
39
|
+
"@allurereport/plugin-progress": "3.7.0",
|
|
40
|
+
"@allurereport/plugin-slack": "3.7.0",
|
|
41
|
+
"@allurereport/plugin-testops": "3.7.0",
|
|
42
|
+
"@allurereport/plugin-testplan": "3.7.0",
|
|
43
|
+
"@allurereport/reader": "3.7.0",
|
|
44
|
+
"@allurereport/reader-api": "3.7.0",
|
|
45
|
+
"@allurereport/service": "3.7.0",
|
|
46
|
+
"@allurereport/summary": "3.7.0",
|
|
47
47
|
"glob": "^13.0.6",
|
|
48
48
|
"handlebars": "^4.7.9",
|
|
49
49
|
"node-stream-zip": "^1.15.0",
|