@allurereport/core 3.7.0 → 3.8.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 +21 -17
- package/dist/report.js +246 -172
- package/dist/store/store.d.ts +5 -1
- package/dist/store/store.js +91 -8
- package/dist/utils/event.d.ts +9 -10
- package/dist/utils/event.js +77 -65
- package/dist/utils/realtimeChannel.d.ts +8 -0
- package/dist/utils/realtimeChannel.js +29 -0
- package/dist/utils/realtimeUpdateScheduler.d.ts +10 -0
- package/dist/utils/realtimeUpdateScheduler.js +81 -0
- package/package.json +20 -20
package/dist/config.js
CHANGED
|
@@ -189,23 +189,27 @@ export const resolveConfig = async (config, override = {}) => {
|
|
|
189
189
|
const output = resolve(override.output ?? config.output ?? "./allure-report");
|
|
190
190
|
const known = await readKnownIssues(knownIssuesPath);
|
|
191
191
|
const variables = config.variables ?? {};
|
|
192
|
-
|
|
193
|
-
const
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
192
|
+
let pluginInstances = [];
|
|
193
|
+
const hasPluginsOverride = override.plugins !== undefined;
|
|
194
|
+
if (!hasPluginsOverride || Object.keys(override.plugins ?? {}).length > 0) {
|
|
195
|
+
const configuredPlugins = hasPluginsOverride ? override.plugins : config.plugins;
|
|
196
|
+
const basePlugins = !hasPluginsOverride && Object.keys(configuredPlugins ?? {}).length === 0
|
|
197
|
+
? {
|
|
198
|
+
awesome: {
|
|
199
|
+
options: {},
|
|
200
|
+
},
|
|
201
|
+
}
|
|
202
|
+
: configuredPlugins;
|
|
203
|
+
const plugins = hasConfiguredAgent(basePlugins)
|
|
204
|
+
? basePlugins
|
|
205
|
+
: {
|
|
206
|
+
...basePlugins,
|
|
207
|
+
agent: {
|
|
208
|
+
options: {},
|
|
209
|
+
},
|
|
210
|
+
};
|
|
211
|
+
pluginInstances = await resolvePlugins(plugins);
|
|
212
|
+
}
|
|
209
213
|
return {
|
|
210
214
|
name,
|
|
211
215
|
output,
|
package/dist/report.js
CHANGED
|
@@ -9,11 +9,10 @@ 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 _AllureReport_instances, _AllureReport_reportName,
|
|
12
|
+
var _AllureReport_instances, _AllureReport_reportName, _AllureReport_ci, _AllureReport_store, _AllureReport_readers, _AllureReport_plugins, _AllureReport_reportFiles, _AllureReport_realtimeChannel, _AllureReport_realtimeUpdateScheduler, _AllureReport_realTime, _AllureReport_hideLabels, _AllureReport_output, _AllureReport_history, _AllureReport_allureServiceClient, _AllureReport_qualityGate, _AllureReport_dump, _AllureReport_categories, _AllureReport_environments, _AllureReport_globalAttachments, _AllureReport_dumpTempDirs, _AllureReport_state, _AllureReport_executionStage, _AllureReport_publish_get, _AllureReport_runRealtimeUpdate, _AllureReport_eachPlugin, _AllureReport_getPluginState;
|
|
13
13
|
import console from "node:console";
|
|
14
14
|
import { randomUUID } from "node:crypto";
|
|
15
|
-
import {
|
|
16
|
-
import { createReadStream, createWriteStream, existsSync, readFileSync } from "node:fs";
|
|
15
|
+
import { createWriteStream, existsSync, readFileSync } from "node:fs";
|
|
17
16
|
import { lstat, mkdtemp, opendir, readdir, realpath, rename, rm, writeFile } from "node:fs/promises";
|
|
18
17
|
import { tmpdir } from "node:os";
|
|
19
18
|
import { basename, dirname, join, resolve, sep } from "node:path";
|
|
@@ -35,7 +34,8 @@ import { DefaultPluginState, PluginFiles } from "./plugin.js";
|
|
|
35
34
|
import { QualityGate } from "./qualityGate/index.js";
|
|
36
35
|
import { DefaultAllureStore } from "./store/store.js";
|
|
37
36
|
import { environmentIdentityById, environmentIdentityByName } from "./utils/environment.js";
|
|
38
|
-
import {
|
|
37
|
+
import { RealtimeChannel } from "./utils/realtimeChannel.js";
|
|
38
|
+
import { RealtimeUpdateScheduler } from "./utils/realtimeUpdateScheduler.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.";
|
|
@@ -48,15 +48,13 @@ export class AllureReport {
|
|
|
48
48
|
constructor(opts) {
|
|
49
49
|
_AllureReport_instances.add(this);
|
|
50
50
|
_AllureReport_reportName.set(this, void 0);
|
|
51
|
-
_AllureReport_reportVariables.set(this, void 0);
|
|
52
51
|
_AllureReport_ci.set(this, void 0);
|
|
53
52
|
_AllureReport_store.set(this, void 0);
|
|
54
53
|
_AllureReport_readers.set(this, void 0);
|
|
55
54
|
_AllureReport_plugins.set(this, void 0);
|
|
56
55
|
_AllureReport_reportFiles.set(this, void 0);
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
_AllureReport_realtimeDispatcher.set(this, void 0);
|
|
56
|
+
_AllureReport_realtimeChannel.set(this, void 0);
|
|
57
|
+
_AllureReport_realtimeUpdateScheduler.set(this, void 0);
|
|
60
58
|
_AllureReport_realTime.set(this, void 0);
|
|
61
59
|
_AllureReport_hideLabels.set(this, void 0);
|
|
62
60
|
_AllureReport_output.set(this, void 0);
|
|
@@ -150,7 +148,7 @@ export class AllureReport {
|
|
|
150
148
|
continue;
|
|
151
149
|
}
|
|
152
150
|
const originalFileName = basename(absoluteFilePath);
|
|
153
|
-
__classPrivateFieldGet(this,
|
|
151
|
+
__classPrivateFieldGet(this, _AllureReport_realtimeChannel, "f").dispatcher.sendGlobalAttachment(new PathResultFile(absoluteFilePath, originalFileName), originalFileName);
|
|
154
152
|
}
|
|
155
153
|
}
|
|
156
154
|
if (__classPrivateFieldGet(this, _AllureReport_allureServiceClient, "f") && __classPrivateFieldGet(this, _AllureReport_instances, "a", _AllureReport_publish_get)) {
|
|
@@ -162,16 +160,16 @@ export class AllureReport {
|
|
|
162
160
|
this.reportUrl = url.href;
|
|
163
161
|
}
|
|
164
162
|
await __classPrivateFieldGet(this, _AllureReport_eachPlugin, "f").call(this, true, async (plugin, context) => {
|
|
165
|
-
await plugin.start?.(context, __classPrivateFieldGet(this, _AllureReport_store, "f"), __classPrivateFieldGet(this,
|
|
163
|
+
await plugin.start?.(context, __classPrivateFieldGet(this, _AllureReport_store, "f"), __classPrivateFieldGet(this, _AllureReport_realtimeChannel, "f").subscriber);
|
|
166
164
|
});
|
|
167
165
|
if (__classPrivateFieldGet(this, _AllureReport_realTime, "f")) {
|
|
168
|
-
await __classPrivateFieldGet(this,
|
|
169
|
-
__classPrivateFieldGet(this,
|
|
170
|
-
|
|
166
|
+
await __classPrivateFieldGet(this, _AllureReport_runRealtimeUpdate, "f").call(this);
|
|
167
|
+
__classPrivateFieldGet(this, _AllureReport_realtimeChannel, "f").onResultLikeChanged(() => {
|
|
168
|
+
__classPrivateFieldGet(this, _AllureReport_realtimeUpdateScheduler, "f").request();
|
|
171
169
|
});
|
|
172
170
|
}
|
|
173
171
|
};
|
|
174
|
-
|
|
172
|
+
_AllureReport_runRealtimeUpdate.set(this, async () => {
|
|
175
173
|
if (__classPrivateFieldGet(this, _AllureReport_executionStage, "f") !== "running") {
|
|
176
174
|
return;
|
|
177
175
|
}
|
|
@@ -180,85 +178,124 @@ export class AllureReport {
|
|
|
180
178
|
});
|
|
181
179
|
});
|
|
182
180
|
this.dumpState = async () => {
|
|
183
|
-
const { testResults, testCases, fixtures, attachments: attachmentsLinks, environments, globalAttachmentIds = [], globalErrors = [], indexAttachmentByTestResult = {}, indexTestResultByHistoryId = {}, indexTestResultByTestCase = {}, indexLatestEnvTestResultByHistoryId = {}, indexAttachmentByFixture = {}, indexFixturesByTestResult = {}, indexKnownByHistoryId = {}, qualityGateResults = [], } = __classPrivateFieldGet(this, _AllureReport_store, "f").dumpState();
|
|
184
|
-
const allAttachments = await __classPrivateFieldGet(this, _AllureReport_store, "f").allAttachments();
|
|
185
181
|
const dumpArchive = new ZipWriteStream({
|
|
186
182
|
zlib: { level: 5 },
|
|
187
183
|
});
|
|
188
184
|
const addEntry = promisify(dumpArchive.entry.bind(dumpArchive));
|
|
189
|
-
const
|
|
190
|
-
const
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
185
|
+
const dumpPath = `${__classPrivateFieldGet(this, _AllureReport_dump, "f")}.zip`;
|
|
186
|
+
const dumpTempPath = `${dumpPath}.${randomUUID()}.tmp`;
|
|
187
|
+
const dumpArchiveWriteStream = createWriteStream(dumpTempPath);
|
|
188
|
+
let dumpArchiveError;
|
|
189
|
+
let dumpArchiveFinished = false;
|
|
190
|
+
let resolveDumpArchivePromise;
|
|
191
|
+
const finishDumpArchive = (err) => {
|
|
192
|
+
dumpArchiveError ?? (dumpArchiveError = err);
|
|
193
|
+
if (!dumpArchiveFinished) {
|
|
194
|
+
dumpArchiveFinished = true;
|
|
195
|
+
resolveDumpArchivePromise?.();
|
|
196
|
+
}
|
|
197
|
+
};
|
|
198
|
+
const dumpArchivePromise = new Promise((res) => {
|
|
199
|
+
resolveDumpArchivePromise = res;
|
|
200
|
+
dumpArchive.on("error", (err) => {
|
|
201
|
+
dumpArchiveWriteStream.destroy();
|
|
202
|
+
finishDumpArchive(err);
|
|
203
|
+
});
|
|
204
|
+
dumpArchiveWriteStream.on("finish", () => finishDumpArchive());
|
|
205
|
+
dumpArchiveWriteStream.on("error", (err) => finishDumpArchive(err));
|
|
194
206
|
});
|
|
207
|
+
const errMessage = (err) => (err instanceof Error ? err.message : String(err));
|
|
208
|
+
const addDumpEntry = async (data, entryName) => {
|
|
209
|
+
try {
|
|
210
|
+
await addEntry(data, { name: entryName });
|
|
211
|
+
return undefined;
|
|
212
|
+
}
|
|
213
|
+
catch (err) {
|
|
214
|
+
return err;
|
|
215
|
+
}
|
|
216
|
+
};
|
|
217
|
+
const addRequiredDumpEntry = async (data, entryName) => {
|
|
218
|
+
const err = await addDumpEntry(data, entryName);
|
|
219
|
+
if (err) {
|
|
220
|
+
throw new Error(`Failed to write dump entry "${entryName}": ${errMessage(err)}`);
|
|
221
|
+
}
|
|
222
|
+
};
|
|
223
|
+
const addJsonDumpEntry = async (entryName, value) => {
|
|
224
|
+
await addRequiredDumpEntry(Buffer.from(JSON.stringify(value)), entryName);
|
|
225
|
+
};
|
|
226
|
+
const dumpJsonEntries = ({ testResults, testCases, fixtures, attachments, environments, reportVariables, checkResults = [], globalAttachmentIds = [], globalErrors = [], indexAttachmentByTestResult = {}, indexTestResultByHistoryId = {}, indexTestResultByTestCase = {}, indexLatestEnvTestResultByHistoryId = {}, indexAttachmentByFixture = {}, indexFixturesByTestResult = {}, indexKnownByHistoryId = {}, qualityGateResults = [], }) => [
|
|
227
|
+
[AllureStoreDumpFiles.TestResults, testResults],
|
|
228
|
+
[AllureStoreDumpFiles.TestCases, testCases],
|
|
229
|
+
[AllureStoreDumpFiles.Fixtures, fixtures],
|
|
230
|
+
[AllureStoreDumpFiles.Attachments, attachments],
|
|
231
|
+
[AllureStoreDumpFiles.CheckResults, checkResults],
|
|
232
|
+
[AllureStoreDumpFiles.Environments, environments],
|
|
233
|
+
[AllureStoreDumpFiles.ReportVariables, reportVariables],
|
|
234
|
+
[AllureStoreDumpFiles.GlobalAttachments, globalAttachmentIds],
|
|
235
|
+
[AllureStoreDumpFiles.GlobalErrors, globalErrors],
|
|
236
|
+
[AllureStoreDumpFiles.IndexAttachmentsByTestResults, indexAttachmentByTestResult],
|
|
237
|
+
[AllureStoreDumpFiles.IndexTestResultsByHistoryId, indexTestResultByHistoryId],
|
|
238
|
+
[AllureStoreDumpFiles.IndexTestResultsByTestCase, indexTestResultByTestCase],
|
|
239
|
+
[AllureStoreDumpFiles.IndexLatestEnvTestResultsByHistoryId, indexLatestEnvTestResultByHistoryId],
|
|
240
|
+
[AllureStoreDumpFiles.IndexAttachmentsByFixture, indexAttachmentByFixture],
|
|
241
|
+
[AllureStoreDumpFiles.IndexFixturesByTestResult, indexFixturesByTestResult],
|
|
242
|
+
[AllureStoreDumpFiles.IndexKnownByHistoryId, indexKnownByHistoryId],
|
|
243
|
+
[AllureStoreDumpFiles.QualityGateResults, qualityGateResults],
|
|
244
|
+
];
|
|
245
|
+
let dumpError;
|
|
195
246
|
dumpArchive.pipe(dumpArchiveWriteStream);
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
await addEntry(Buffer.from(JSON.stringify(indexTestResultByHistoryId)), {
|
|
224
|
-
name: AllureStoreDumpFiles.IndexTestResultsByHistoryId,
|
|
225
|
-
});
|
|
226
|
-
await addEntry(Buffer.from(JSON.stringify(indexTestResultByTestCase)), {
|
|
227
|
-
name: AllureStoreDumpFiles.IndexTestResultsByTestCase,
|
|
228
|
-
});
|
|
229
|
-
await addEntry(Buffer.from(JSON.stringify(indexLatestEnvTestResultByHistoryId)), {
|
|
230
|
-
name: AllureStoreDumpFiles.IndexLatestEnvTestResultsByHistoryId,
|
|
231
|
-
});
|
|
232
|
-
await addEntry(Buffer.from(JSON.stringify(indexAttachmentByFixture)), {
|
|
233
|
-
name: AllureStoreDumpFiles.IndexAttachmentsByFixture,
|
|
234
|
-
});
|
|
235
|
-
await addEntry(Buffer.from(JSON.stringify(indexFixturesByTestResult)), {
|
|
236
|
-
name: AllureStoreDumpFiles.IndexFixturesByTestResult,
|
|
237
|
-
});
|
|
238
|
-
await addEntry(Buffer.from(JSON.stringify(indexKnownByHistoryId)), {
|
|
239
|
-
name: AllureStoreDumpFiles.IndexKnownByHistoryId,
|
|
240
|
-
});
|
|
241
|
-
await addEntry(Buffer.from(JSON.stringify(qualityGateResults)), {
|
|
242
|
-
name: AllureStoreDumpFiles.QualityGateResults,
|
|
243
|
-
});
|
|
244
|
-
for (const attachment of allAttachments) {
|
|
245
|
-
const content = await __classPrivateFieldGet(this, _AllureReport_store, "f").attachmentContentById(attachment.id);
|
|
246
|
-
if (!content) {
|
|
247
|
-
continue;
|
|
247
|
+
try {
|
|
248
|
+
const allAttachments = await __classPrivateFieldGet(this, _AllureReport_store, "f").allAttachments();
|
|
249
|
+
for (const attachment of allAttachments) {
|
|
250
|
+
const skipAttachment = (message) => {
|
|
251
|
+
const originalFileName = attachment.originalFileName ? ` (${attachment.originalFileName})` : "";
|
|
252
|
+
__classPrivateFieldGet(this, _AllureReport_store, "f").markAttachmentMissed(attachment.id);
|
|
253
|
+
console.warn(`Skipping attachment while writing dump: ${attachment.id}${originalFileName}. ${message}`);
|
|
254
|
+
};
|
|
255
|
+
try {
|
|
256
|
+
const content = await __classPrivateFieldGet(this, _AllureReport_store, "f").attachmentContentById(attachment.id);
|
|
257
|
+
if (!content) {
|
|
258
|
+
skipAttachment("attachment content is missing");
|
|
259
|
+
continue;
|
|
260
|
+
}
|
|
261
|
+
const data = await content.asBuffer();
|
|
262
|
+
if (data === undefined) {
|
|
263
|
+
skipAttachment("attachment content is missing");
|
|
264
|
+
continue;
|
|
265
|
+
}
|
|
266
|
+
const err = await addDumpEntry(data, attachment.id);
|
|
267
|
+
if (err) {
|
|
268
|
+
skipAttachment(`failed to add attachment entry: ${errMessage(err)}`);
|
|
269
|
+
}
|
|
270
|
+
}
|
|
271
|
+
catch (err) {
|
|
272
|
+
skipAttachment(errMessage(err));
|
|
273
|
+
}
|
|
248
274
|
}
|
|
249
|
-
|
|
250
|
-
await
|
|
251
|
-
name: attachment.id,
|
|
252
|
-
});
|
|
275
|
+
for (const [entryName, value] of dumpJsonEntries(__classPrivateFieldGet(this, _AllureReport_store, "f").dumpState())) {
|
|
276
|
+
await addJsonDumpEntry(entryName, value);
|
|
253
277
|
}
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
278
|
+
}
|
|
279
|
+
catch (err) {
|
|
280
|
+
dumpError = err;
|
|
281
|
+
}
|
|
282
|
+
finally {
|
|
283
|
+
try {
|
|
284
|
+
dumpArchive.finalize();
|
|
258
285
|
}
|
|
286
|
+
catch (err) {
|
|
287
|
+
dumpError ?? (dumpError = err);
|
|
288
|
+
dumpArchiveWriteStream.destroy();
|
|
289
|
+
finishDumpArchive(err);
|
|
290
|
+
}
|
|
291
|
+
await dumpArchivePromise;
|
|
292
|
+
}
|
|
293
|
+
dumpError ?? (dumpError = dumpArchiveError);
|
|
294
|
+
if (dumpError) {
|
|
295
|
+
await rm(dumpTempPath, { force: true });
|
|
296
|
+
throw dumpError;
|
|
259
297
|
}
|
|
260
|
-
|
|
261
|
-
return promise;
|
|
298
|
+
await rename(dumpTempPath, dumpPath);
|
|
262
299
|
};
|
|
263
300
|
this.restoreState = async (dumps) => {
|
|
264
301
|
for (const dump of dumps) {
|
|
@@ -268,88 +305,121 @@ export class AllureReport {
|
|
|
268
305
|
const dumpArchive = new ZipReadStream.async({
|
|
269
306
|
file: dump,
|
|
270
307
|
});
|
|
271
|
-
const testResultsEntry = await dumpArchive.entryData(AllureStoreDumpFiles.TestResults);
|
|
272
|
-
const testCasesEntry = await dumpArchive.entryData(AllureStoreDumpFiles.TestCases);
|
|
273
|
-
const fixturesEntry = await dumpArchive.entryData(AllureStoreDumpFiles.Fixtures);
|
|
274
|
-
const attachmentsEntry = await dumpArchive.entryData(AllureStoreDumpFiles.Attachments);
|
|
275
|
-
const environmentsEntry = await dumpArchive.entryData(AllureStoreDumpFiles.Environments);
|
|
276
|
-
const reportVariablesEntry = await dumpArchive.entryData(AllureStoreDumpFiles.ReportVariables);
|
|
277
|
-
const globalAttachmentsEntry = await dumpArchive.entryData(AllureStoreDumpFiles.GlobalAttachments);
|
|
278
|
-
const globalErrorsEntry = await dumpArchive.entryData(AllureStoreDumpFiles.GlobalErrors);
|
|
279
|
-
const indexAttachmentsEntry = await dumpArchive.entryData(AllureStoreDumpFiles.IndexAttachmentsByTestResults);
|
|
280
|
-
const indexTestResultsByHistoryId = await dumpArchive.entryData(AllureStoreDumpFiles.IndexTestResultsByHistoryId);
|
|
281
|
-
const indexTestResultsByTestCaseEntry = await dumpArchive.entryData(AllureStoreDumpFiles.IndexTestResultsByTestCase);
|
|
282
|
-
const indexLatestEnvTestResultsByHistoryIdEntry = await dumpArchive.entryData(AllureStoreDumpFiles.IndexLatestEnvTestResultsByHistoryId);
|
|
283
|
-
const indexAttachmentsByFixtureEntry = await dumpArchive.entryData(AllureStoreDumpFiles.IndexAttachmentsByFixture);
|
|
284
|
-
const indexFixturesByTestResultEntry = await dumpArchive.entryData(AllureStoreDumpFiles.IndexFixturesByTestResult);
|
|
285
|
-
const indexKnownByHistoryIdEntry = await dumpArchive.entryData(AllureStoreDumpFiles.IndexKnownByHistoryId);
|
|
286
|
-
const qualityGateResultsEntry = await dumpArchive.entryData(AllureStoreDumpFiles.QualityGateResults);
|
|
287
|
-
const attachmentsEntries = Object.entries(await dumpArchive.entries()).reduce((acc, [entryName, entry]) => {
|
|
288
|
-
switch (entryName) {
|
|
289
|
-
case AllureStoreDumpFiles.Attachments:
|
|
290
|
-
case AllureStoreDumpFiles.TestResults:
|
|
291
|
-
case AllureStoreDumpFiles.TestCases:
|
|
292
|
-
case AllureStoreDumpFiles.Fixtures:
|
|
293
|
-
case AllureStoreDumpFiles.Environments:
|
|
294
|
-
case AllureStoreDumpFiles.ReportVariables:
|
|
295
|
-
case AllureStoreDumpFiles.GlobalAttachments:
|
|
296
|
-
case AllureStoreDumpFiles.GlobalErrors:
|
|
297
|
-
case AllureStoreDumpFiles.IndexAttachmentsByTestResults:
|
|
298
|
-
case AllureStoreDumpFiles.IndexTestResultsByHistoryId:
|
|
299
|
-
case AllureStoreDumpFiles.IndexTestResultsByTestCase:
|
|
300
|
-
case AllureStoreDumpFiles.IndexLatestEnvTestResultsByHistoryId:
|
|
301
|
-
case AllureStoreDumpFiles.IndexAttachmentsByFixture:
|
|
302
|
-
case AllureStoreDumpFiles.IndexFixturesByTestResult:
|
|
303
|
-
case AllureStoreDumpFiles.IndexKnownByHistoryId:
|
|
304
|
-
case AllureStoreDumpFiles.QualityGateResults:
|
|
305
|
-
return acc;
|
|
306
|
-
default:
|
|
307
|
-
return Object.assign(acc, {
|
|
308
|
-
[entryName]: entry,
|
|
309
|
-
});
|
|
310
|
-
}
|
|
311
|
-
}, {});
|
|
312
|
-
const dumpState = {
|
|
313
|
-
testResults: JSON.parse(testResultsEntry.toString("utf8")),
|
|
314
|
-
testCases: JSON.parse(testCasesEntry.toString("utf8")),
|
|
315
|
-
fixtures: JSON.parse(fixturesEntry.toString("utf8")),
|
|
316
|
-
attachments: JSON.parse(attachmentsEntry.toString("utf8")),
|
|
317
|
-
environments: JSON.parse(environmentsEntry.toString("utf8")),
|
|
318
|
-
reportVariables: JSON.parse(reportVariablesEntry.toString("utf8")),
|
|
319
|
-
globalAttachmentIds: JSON.parse(globalAttachmentsEntry.toString("utf8")),
|
|
320
|
-
globalErrors: JSON.parse(globalErrorsEntry.toString("utf8")),
|
|
321
|
-
indexAttachmentByTestResult: JSON.parse(indexAttachmentsEntry.toString("utf8")),
|
|
322
|
-
indexTestResultByHistoryId: JSON.parse(indexTestResultsByHistoryId.toString("utf8")),
|
|
323
|
-
indexTestResultByTestCase: JSON.parse(indexTestResultsByTestCaseEntry.toString("utf8")),
|
|
324
|
-
indexLatestEnvTestResultByHistoryId: JSON.parse(indexLatestEnvTestResultsByHistoryIdEntry.toString("utf8")),
|
|
325
|
-
indexAttachmentByFixture: JSON.parse(indexAttachmentsByFixtureEntry.toString("utf8")),
|
|
326
|
-
indexFixturesByTestResult: JSON.parse(indexFixturesByTestResultEntry.toString("utf8")),
|
|
327
|
-
indexKnownByHistoryId: JSON.parse(indexKnownByHistoryIdEntry.toString("utf8")),
|
|
328
|
-
qualityGateResults: JSON.parse(qualityGateResultsEntry.toString("utf8")),
|
|
329
|
-
};
|
|
330
|
-
const dumpTempDir = await mkdtemp(join(tmpdir(), basename(dump, ".zip")));
|
|
331
|
-
const resultsAttachments = {};
|
|
332
|
-
__classPrivateFieldGet(this, _AllureReport_dumpTempDirs, "f").push(dumpTempDir);
|
|
333
308
|
try {
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
309
|
+
const dumpEntries = await dumpArchive.entries();
|
|
310
|
+
const dumpEntriesList = Object.entries(dumpEntries);
|
|
311
|
+
const optionalEntryData = async (entryName) => dumpEntries[entryName] ? dumpArchive.entryData(entryName) : undefined;
|
|
312
|
+
if (!dumpEntries[AllureStoreDumpFiles.TestResults]) {
|
|
313
|
+
const nestedDumpEntries = dumpEntriesList.filter(([entryName, entry]) => !entry.isDirectory &&
|
|
314
|
+
!entryName.startsWith("__MACOSX/") &&
|
|
315
|
+
!basename(entryName).startsWith("._") &&
|
|
316
|
+
entryName.toLowerCase().endsWith(".zip"));
|
|
317
|
+
if (nestedDumpEntries.length > 0) {
|
|
318
|
+
const nestedDumpsTempDir = await mkdtemp(join(tmpdir(), `${basename(dump, ".zip")}-nested-`));
|
|
319
|
+
const nestedDumpPaths = [];
|
|
320
|
+
__classPrivateFieldGet(this, _AllureReport_dumpTempDirs, "f").push(nestedDumpsTempDir);
|
|
321
|
+
for (const [entryName] of nestedDumpEntries) {
|
|
322
|
+
const nestedDumpPath = join(nestedDumpsTempDir, `${nestedDumpPaths.length}-${basename(entryName)}`);
|
|
323
|
+
await writeFile(nestedDumpPath, await dumpArchive.entryData(entryName));
|
|
324
|
+
nestedDumpPaths.push(nestedDumpPath);
|
|
325
|
+
}
|
|
326
|
+
await this.restoreState(nestedDumpPaths);
|
|
327
|
+
continue;
|
|
328
|
+
}
|
|
339
329
|
}
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
330
|
+
const testResultsEntry = await dumpArchive.entryData(AllureStoreDumpFiles.TestResults);
|
|
331
|
+
const testCasesEntry = await dumpArchive.entryData(AllureStoreDumpFiles.TestCases);
|
|
332
|
+
const fixturesEntry = await dumpArchive.entryData(AllureStoreDumpFiles.Fixtures);
|
|
333
|
+
const attachmentsEntry = await dumpArchive.entryData(AllureStoreDumpFiles.Attachments);
|
|
334
|
+
const checkResultsEntry = await optionalEntryData(AllureStoreDumpFiles.CheckResults);
|
|
335
|
+
const environmentsEntry = await dumpArchive.entryData(AllureStoreDumpFiles.Environments);
|
|
336
|
+
const reportVariablesEntry = await dumpArchive.entryData(AllureStoreDumpFiles.ReportVariables);
|
|
337
|
+
const globalAttachmentsEntry = await dumpArchive.entryData(AllureStoreDumpFiles.GlobalAttachments);
|
|
338
|
+
const globalErrorsEntry = await dumpArchive.entryData(AllureStoreDumpFiles.GlobalErrors);
|
|
339
|
+
const indexAttachmentsEntry = await dumpArchive.entryData(AllureStoreDumpFiles.IndexAttachmentsByTestResults);
|
|
340
|
+
const indexTestResultsByHistoryId = await dumpArchive.entryData(AllureStoreDumpFiles.IndexTestResultsByHistoryId);
|
|
341
|
+
const indexTestResultsByTestCaseEntry = await dumpArchive.entryData(AllureStoreDumpFiles.IndexTestResultsByTestCase);
|
|
342
|
+
const indexLatestEnvTestResultsByHistoryIdEntry = await dumpArchive.entryData(AllureStoreDumpFiles.IndexLatestEnvTestResultsByHistoryId);
|
|
343
|
+
const indexAttachmentsByFixtureEntry = await dumpArchive.entryData(AllureStoreDumpFiles.IndexAttachmentsByFixture);
|
|
344
|
+
const indexFixturesByTestResultEntry = await dumpArchive.entryData(AllureStoreDumpFiles.IndexFixturesByTestResult);
|
|
345
|
+
const indexKnownByHistoryIdEntry = await dumpArchive.entryData(AllureStoreDumpFiles.IndexKnownByHistoryId);
|
|
346
|
+
const qualityGateResultsEntry = await dumpArchive.entryData(AllureStoreDumpFiles.QualityGateResults);
|
|
347
|
+
const attachmentsLinks = JSON.parse(attachmentsEntry.toString("utf8"));
|
|
348
|
+
const attachmentsEntries = dumpEntriesList.reduce((acc, [entryName, entry]) => {
|
|
349
|
+
switch (entryName) {
|
|
350
|
+
case AllureStoreDumpFiles.Attachments:
|
|
351
|
+
case AllureStoreDumpFiles.CheckResults:
|
|
352
|
+
case AllureStoreDumpFiles.TestResults:
|
|
353
|
+
case AllureStoreDumpFiles.TestCases:
|
|
354
|
+
case AllureStoreDumpFiles.Fixtures:
|
|
355
|
+
case AllureStoreDumpFiles.Environments:
|
|
356
|
+
case AllureStoreDumpFiles.ReportVariables:
|
|
357
|
+
case AllureStoreDumpFiles.GlobalAttachments:
|
|
358
|
+
case AllureStoreDumpFiles.GlobalErrors:
|
|
359
|
+
case AllureStoreDumpFiles.IndexAttachmentsByTestResults:
|
|
360
|
+
case AllureStoreDumpFiles.IndexTestResultsByHistoryId:
|
|
361
|
+
case AllureStoreDumpFiles.IndexTestResultsByTestCase:
|
|
362
|
+
case AllureStoreDumpFiles.IndexLatestEnvTestResultsByHistoryId:
|
|
363
|
+
case AllureStoreDumpFiles.IndexAttachmentsByFixture:
|
|
364
|
+
case AllureStoreDumpFiles.IndexFixturesByTestResult:
|
|
365
|
+
case AllureStoreDumpFiles.IndexKnownByHistoryId:
|
|
366
|
+
case AllureStoreDumpFiles.QualityGateResults:
|
|
367
|
+
return acc;
|
|
368
|
+
default:
|
|
369
|
+
if (entry.isDirectory || !attachmentsLinks[entryName] || attachmentsLinks[entryName].missed) {
|
|
370
|
+
return acc;
|
|
371
|
+
}
|
|
372
|
+
return Object.assign(acc, {
|
|
373
|
+
[entryName]: entry,
|
|
374
|
+
});
|
|
375
|
+
}
|
|
376
|
+
}, {});
|
|
377
|
+
const dumpState = {
|
|
378
|
+
testResults: JSON.parse(testResultsEntry.toString("utf8")),
|
|
379
|
+
testCases: JSON.parse(testCasesEntry.toString("utf8")),
|
|
380
|
+
fixtures: JSON.parse(fixturesEntry.toString("utf8")),
|
|
381
|
+
attachments: attachmentsLinks,
|
|
382
|
+
checkResults: checkResultsEntry ? JSON.parse(checkResultsEntry.toString("utf8")) : [],
|
|
383
|
+
environments: JSON.parse(environmentsEntry.toString("utf8")),
|
|
384
|
+
reportVariables: JSON.parse(reportVariablesEntry.toString("utf8")),
|
|
385
|
+
globalAttachmentIds: JSON.parse(globalAttachmentsEntry.toString("utf8")),
|
|
386
|
+
globalErrors: JSON.parse(globalErrorsEntry.toString("utf8")),
|
|
387
|
+
indexAttachmentByTestResult: JSON.parse(indexAttachmentsEntry.toString("utf8")),
|
|
388
|
+
indexTestResultByHistoryId: JSON.parse(indexTestResultsByHistoryId.toString("utf8")),
|
|
389
|
+
indexTestResultByTestCase: JSON.parse(indexTestResultsByTestCaseEntry.toString("utf8")),
|
|
390
|
+
indexLatestEnvTestResultByHistoryId: JSON.parse(indexLatestEnvTestResultsByHistoryIdEntry.toString("utf8")),
|
|
391
|
+
indexAttachmentByFixture: JSON.parse(indexAttachmentsByFixtureEntry.toString("utf8")),
|
|
392
|
+
indexFixturesByTestResult: JSON.parse(indexFixturesByTestResultEntry.toString("utf8")),
|
|
393
|
+
indexKnownByHistoryId: JSON.parse(indexKnownByHistoryIdEntry.toString("utf8")),
|
|
394
|
+
qualityGateResults: JSON.parse(qualityGateResultsEntry.toString("utf8")),
|
|
395
|
+
};
|
|
396
|
+
const dumpTempDir = await mkdtemp(join(tmpdir(), basename(dump, ".zip")));
|
|
397
|
+
const resultsAttachments = {};
|
|
398
|
+
__classPrivateFieldGet(this, _AllureReport_dumpTempDirs, "f").push(dumpTempDir);
|
|
399
|
+
try {
|
|
400
|
+
for (const [attachmentId] of Object.entries(attachmentsEntries)) {
|
|
401
|
+
const attachmentContentEntry = await dumpArchive.entryData(attachmentId);
|
|
402
|
+
const attachmentFilePath = resolveDumpAttachmentPath(dumpTempDir, attachmentId);
|
|
403
|
+
await writeFile(attachmentFilePath, attachmentContentEntry);
|
|
404
|
+
resultsAttachments[attachmentId] = new PathResultFile(attachmentFilePath, attachmentId);
|
|
405
|
+
}
|
|
347
406
|
}
|
|
348
|
-
|
|
349
|
-
|
|
407
|
+
catch (err) {
|
|
408
|
+
if (err instanceof UnsafeDumpPathError) {
|
|
409
|
+
console.error(`Cannot restore dump from "${dump}": the archive lists attachment paths that would write outside the extract directory (unsafe zip paths such as "../" or absolute names).`);
|
|
410
|
+
console.error(err.message);
|
|
411
|
+
console.error("Only use dump archives produced by this tool; do not load untrusted or third-party --dump zip files.");
|
|
412
|
+
throw err;
|
|
413
|
+
}
|
|
414
|
+
console.error(`Can't restore state from "${dump}", continuing without it`);
|
|
415
|
+
console.error(err);
|
|
416
|
+
}
|
|
417
|
+
await __classPrivateFieldGet(this, _AllureReport_store, "f").restoreState(dumpState, resultsAttachments);
|
|
418
|
+
console.info(`Successfully restored state from "${dump}"`);
|
|
419
|
+
}
|
|
420
|
+
finally {
|
|
421
|
+
await dumpArchive.close();
|
|
350
422
|
}
|
|
351
|
-
await __classPrivateFieldGet(this, _AllureReport_store, "f").restoreState(dumpState, resultsAttachments);
|
|
352
|
-
console.info(`Successfully restored state from "${dump}"`);
|
|
353
423
|
}
|
|
354
424
|
};
|
|
355
425
|
this.done = async () => {
|
|
@@ -363,7 +433,13 @@ export class AllureReport {
|
|
|
363
433
|
const testResults = await __classPrivateFieldGet(this, _AllureReport_store, "f").allTestResults();
|
|
364
434
|
const testCases = await __classPrivateFieldGet(this, _AllureReport_store, "f").allTestCases();
|
|
365
435
|
const historyDataPoint = createHistory(this.reportUuid, __classPrivateFieldGet(this, _AllureReport_reportName, "f"), testCases, testResults, this.reportUrl);
|
|
366
|
-
__classPrivateFieldGet(this,
|
|
436
|
+
__classPrivateFieldGet(this, _AllureReport_realtimeChannel, "f").close();
|
|
437
|
+
try {
|
|
438
|
+
await __classPrivateFieldGet(this, _AllureReport_realtimeUpdateScheduler, "f").close();
|
|
439
|
+
}
|
|
440
|
+
catch (e) {
|
|
441
|
+
console.error("realtime update failed during shutdown", e);
|
|
442
|
+
}
|
|
367
443
|
__classPrivateFieldSet(this, _AllureReport_executionStage, "done", "f");
|
|
368
444
|
if (__classPrivateFieldGet(this, _AllureReport_dump, "f")) {
|
|
369
445
|
await this.dumpState();
|
|
@@ -586,7 +662,7 @@ export class AllureReport {
|
|
|
586
662
|
if (allureServiceConfig?.legacy) {
|
|
587
663
|
__classPrivateFieldSet(this, _AllureReport_allureServiceClient, new AllureLegacyServiceClient(allureServiceConfig), "f");
|
|
588
664
|
}
|
|
589
|
-
else
|
|
665
|
+
else {
|
|
590
666
|
__classPrivateFieldSet(this, _AllureReport_allureServiceClient, new AllureServiceClient(allureServiceConfig), "f");
|
|
591
667
|
}
|
|
592
668
|
}
|
|
@@ -594,10 +670,8 @@ export class AllureReport {
|
|
|
594
670
|
__classPrivateFieldSet(this, _AllureReport_ci, detect(), "f");
|
|
595
671
|
const reportTitleSuffix = __classPrivateFieldGet(this, _AllureReport_ci, "f")?.pullRequestName ?? __classPrivateFieldGet(this, _AllureReport_ci, "f")?.jobRunName;
|
|
596
672
|
__classPrivateFieldSet(this, _AllureReport_reportName, [name, reportTitleSuffix].filter(Boolean).join(" – "), "f");
|
|
597
|
-
__classPrivateFieldSet(this,
|
|
598
|
-
__classPrivateFieldSet(this,
|
|
599
|
-
__classPrivateFieldSet(this, _AllureReport_realtimeDispatcher, new RealtimeEventsDispatcher(__classPrivateFieldGet(this, _AllureReport_eventEmitter, "f")), "f");
|
|
600
|
-
__classPrivateFieldSet(this, _AllureReport_realtimeSubscriber, new RealtimeSubscriber(__classPrivateFieldGet(this, _AllureReport_eventEmitter, "f")), "f");
|
|
673
|
+
__classPrivateFieldSet(this, _AllureReport_realtimeChannel, new RealtimeChannel(), "f");
|
|
674
|
+
__classPrivateFieldSet(this, _AllureReport_realtimeUpdateScheduler, new RealtimeUpdateScheduler(__classPrivateFieldGet(this, _AllureReport_runRealtimeUpdate, "f")), "f");
|
|
601
675
|
__classPrivateFieldSet(this, _AllureReport_realTime, realTime, "f");
|
|
602
676
|
__classPrivateFieldSet(this, _AllureReport_dump, dump, "f");
|
|
603
677
|
__classPrivateFieldSet(this, _AllureReport_hideLabels, hideLabels, "f");
|
|
@@ -621,8 +695,8 @@ export class AllureReport {
|
|
|
621
695
|
}), "f");
|
|
622
696
|
}
|
|
623
697
|
__classPrivateFieldSet(this, _AllureReport_store, new DefaultAllureStore({
|
|
624
|
-
realtimeSubscriber: __classPrivateFieldGet(this,
|
|
625
|
-
realtimeDispatcher: __classPrivateFieldGet(this,
|
|
698
|
+
realtimeSubscriber: __classPrivateFieldGet(this, _AllureReport_realtimeChannel, "f").subscriber,
|
|
699
|
+
realtimeDispatcher: __classPrivateFieldGet(this, _AllureReport_realtimeChannel, "f").dispatcher,
|
|
626
700
|
reportVariables: variables,
|
|
627
701
|
environmentsConfig: environments,
|
|
628
702
|
history: __classPrivateFieldGet(this, _AllureReport_history, "f"),
|
|
@@ -643,13 +717,13 @@ export class AllureReport {
|
|
|
643
717
|
return __classPrivateFieldGet(this, _AllureReport_store, "f");
|
|
644
718
|
}
|
|
645
719
|
get realtimeSubscriber() {
|
|
646
|
-
return __classPrivateFieldGet(this,
|
|
720
|
+
return __classPrivateFieldGet(this, _AllureReport_realtimeChannel, "f").subscriber;
|
|
647
721
|
}
|
|
648
722
|
get realtimeDispatcher() {
|
|
649
|
-
return __classPrivateFieldGet(this,
|
|
723
|
+
return __classPrivateFieldGet(this, _AllureReport_realtimeChannel, "f").dispatcher;
|
|
650
724
|
}
|
|
651
725
|
}
|
|
652
|
-
_AllureReport_reportName = new WeakMap(),
|
|
726
|
+
_AllureReport_reportName = new WeakMap(), _AllureReport_ci = new WeakMap(), _AllureReport_store = new WeakMap(), _AllureReport_readers = new WeakMap(), _AllureReport_plugins = new WeakMap(), _AllureReport_reportFiles = new WeakMap(), _AllureReport_realtimeChannel = new WeakMap(), _AllureReport_realtimeUpdateScheduler = new WeakMap(), _AllureReport_realTime = new WeakMap(), _AllureReport_hideLabels = new WeakMap(), _AllureReport_output = new WeakMap(), _AllureReport_history = new WeakMap(), _AllureReport_allureServiceClient = new WeakMap(), _AllureReport_qualityGate = new WeakMap(), _AllureReport_dump = new WeakMap(), _AllureReport_categories = new WeakMap(), _AllureReport_environments = new WeakMap(), _AllureReport_globalAttachments = new WeakMap(), _AllureReport_dumpTempDirs = new WeakMap(), _AllureReport_state = new WeakMap(), _AllureReport_executionStage = new WeakMap(), _AllureReport_runRealtimeUpdate = new WeakMap(), _AllureReport_eachPlugin = new WeakMap(), _AllureReport_instances = new WeakSet(), _AllureReport_publish_get = function _AllureReport_publish_get() {
|
|
653
727
|
return __classPrivateFieldGet(this, _AllureReport_plugins, "f").some(({ enabled, options }) => enabled && options.publish);
|
|
654
728
|
}, _AllureReport_getPluginState = function _AllureReport_getPluginState(init, id) {
|
|
655
729
|
return init ? new DefaultPluginState({}) : __classPrivateFieldGet(this, _AllureReport_state, "f")?.[id];
|
package/dist/store/store.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { type AllureHistory, type AttachmentLink, type DefaultLabelsConfig, type EnvironmentIdentity, type EnvironmentsConfig, type HistoryDataPoint, type HistoryTestResult, type KnownTestFailure, type ReportVariables, type Statistic, type TestCase, type TestEnvGroup, type TestError, type TestFixtureResult, type TestResult } from "@allurereport/core-api";
|
|
1
|
+
import { type AllureCheckResult, type AllureHistory, type AttachmentLink, type DefaultLabelsConfig, type EnvironmentIdentity, type EnvironmentsConfig, type HistoryDataPoint, type HistoryTestResult, type KnownTestFailure, type ReportVariables, type Statistic, type TestCase, type TestEnvGroup, type TestError, type TestFixtureResult, type TestResult } from "@allurereport/core-api";
|
|
2
2
|
import { type AllureStore, type AllureStoreDump, type ExitCode, type PluginGlobalAttachment, type PluginGlobalError, type QualityGateValidationResult, type RealtimeEventsDispatcher, type RealtimeSubscriber, type ResultFile, type TestResultFilter } from "@allurereport/plugin-api";
|
|
3
3
|
import type { RawFixtureResult, RawGlobals, RawMetadata, RawTestResult, ReaderContext, ResultsVisitor } from "@allurereport/reader-api";
|
|
4
4
|
export declare const mapToObject: <K extends string | number | symbol, T = any>(map: Map<K, T>) => Record<K, T>;
|
|
@@ -26,6 +26,8 @@ export declare class DefaultAllureStore implements AllureStore, ResultsVisitor {
|
|
|
26
26
|
});
|
|
27
27
|
readHistory(): Promise<HistoryDataPoint[]>;
|
|
28
28
|
appendHistory(history: HistoryDataPoint): Promise<void>;
|
|
29
|
+
addCheckResult(result: AllureCheckResult): Promise<void>;
|
|
30
|
+
allCheckResults(): Promise<AllureCheckResult[]>;
|
|
29
31
|
qualityGateResults(): Promise<QualityGateValidationResult[]>;
|
|
30
32
|
qualityGateResultsByEnv(): Promise<Record<string, QualityGateValidationResult[]>>;
|
|
31
33
|
qualityGateResultsByEnvironmentId(): Promise<Record<string, QualityGateValidationResult[]>>;
|
|
@@ -34,6 +36,7 @@ export declare class DefaultAllureStore implements AllureStore, ResultsVisitor {
|
|
|
34
36
|
allGlobalErrorsByEnv(): Promise<Record<string, PluginGlobalError[]>>;
|
|
35
37
|
allGlobalAttachments(): Promise<AttachmentLink[]>;
|
|
36
38
|
allGlobalAttachmentsByEnv(): Promise<Record<string, PluginGlobalAttachment[]>>;
|
|
39
|
+
visitCheckResult(result: AllureCheckResult): Promise<void>;
|
|
37
40
|
visitTestResult(raw: RawTestResult, context: ReaderContext): Promise<void>;
|
|
38
41
|
visitTestFixtureResult(result: RawFixtureResult, context: ReaderContext): Promise<void>;
|
|
39
42
|
visitAttachmentFile(resultFile: ResultFile): Promise<void>;
|
|
@@ -59,6 +62,7 @@ export declare class DefaultAllureStore implements AllureStore, ResultsVisitor {
|
|
|
59
62
|
testResultById(trId: string): Promise<TestResult | undefined>;
|
|
60
63
|
attachmentById(attachmentId: string): Promise<AttachmentLink | undefined>;
|
|
61
64
|
attachmentContentById(attachmentId: string): Promise<ResultFile | undefined>;
|
|
65
|
+
markAttachmentMissed(attachmentId: string): void;
|
|
62
66
|
metadataByKey<T>(key: string): Promise<T | undefined>;
|
|
63
67
|
testResultsByTcId(tcId: string): Promise<TestResult[]>;
|
|
64
68
|
environmentIdByTrId(trId: string): Promise<string | undefined>;
|
package/dist/store/store.js
CHANGED
|
@@ -9,7 +9,7 @@ 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_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;
|
|
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;
|
|
13
13
|
import { extname } from "node:path";
|
|
14
14
|
import { DEFAULT_ENVIRONMENT, DEFAULT_ENVIRONMENT_IDENTITY, compareBy, createDictionary, getHistoryIdCandidates, getWorstStatus, nullsLast, ordinal, reverse, selectHistoryTestResults, validateEnvironmentId, validateEnvironmentName, } from "@allurereport/core-api";
|
|
15
15
|
import { md5, } from "@allurereport/plugin-api";
|
|
@@ -64,6 +64,18 @@ export const updateMapWithRecord = (map, record) => {
|
|
|
64
64
|
});
|
|
65
65
|
return map;
|
|
66
66
|
};
|
|
67
|
+
const relinkAttachmentSteps = (steps = [], attachments) => {
|
|
68
|
+
steps.forEach((step) => {
|
|
69
|
+
if (step.type === "attachment") {
|
|
70
|
+
const restoredLink = attachments.get(step.link.id);
|
|
71
|
+
if (restoredLink && restoredLink.used) {
|
|
72
|
+
step.link = restoredLink;
|
|
73
|
+
}
|
|
74
|
+
return;
|
|
75
|
+
}
|
|
76
|
+
relinkAttachmentSteps(step.steps, attachments);
|
|
77
|
+
});
|
|
78
|
+
};
|
|
67
79
|
export class DefaultAllureStore {
|
|
68
80
|
constructor(params) {
|
|
69
81
|
_DefaultAllureStore_instances.add(this);
|
|
@@ -97,6 +109,7 @@ export class DefaultAllureStore {
|
|
|
97
109
|
_DefaultAllureStore_globalErrors.set(this, []);
|
|
98
110
|
_DefaultAllureStore_globalErrorsByEnv.set(this, new Map());
|
|
99
111
|
_DefaultAllureStore_globalExitCode.set(this, void 0);
|
|
112
|
+
_DefaultAllureStore_checkResults.set(this, []);
|
|
100
113
|
_DefaultAllureStore_qualityGateResults.set(this, []);
|
|
101
114
|
_DefaultAllureStore_historyPoints.set(this, []);
|
|
102
115
|
_DefaultAllureStore_environments.set(this, []);
|
|
@@ -135,7 +148,7 @@ export class DefaultAllureStore {
|
|
|
135
148
|
__classPrivateFieldSet(this, _DefaultAllureStore_reportVariables, reportVariables, "f");
|
|
136
149
|
__classPrivateFieldSet(this, _DefaultAllureStore_allowedEnvironmentIds, new Set(allowedEnvironments ?? []), "f");
|
|
137
150
|
__classPrivateFieldGet(this, _DefaultAllureStore_instances, "m", _DefaultAllureStore_addEnvironments).call(this, environments);
|
|
138
|
-
__classPrivateFieldGet(this, _DefaultAllureStore_realtimeSubscriber, "f")?.onQualityGateResults(
|
|
151
|
+
__classPrivateFieldGet(this, _DefaultAllureStore_realtimeSubscriber, "f")?.onQualityGateResults((results) => {
|
|
139
152
|
__classPrivateFieldGet(this, _DefaultAllureStore_qualityGateResults, "f").push(...results);
|
|
140
153
|
__classPrivateFieldGet(this, _DefaultAllureStore_instances, "m", _DefaultAllureStore_addEnvironments).call(this, results
|
|
141
154
|
.map((result) => {
|
|
@@ -156,13 +169,13 @@ export class DefaultAllureStore {
|
|
|
156
169
|
})
|
|
157
170
|
.filter(Boolean));
|
|
158
171
|
});
|
|
159
|
-
__classPrivateFieldGet(this, _DefaultAllureStore_realtimeSubscriber, "f")?.onGlobalExitCode(
|
|
172
|
+
__classPrivateFieldGet(this, _DefaultAllureStore_realtimeSubscriber, "f")?.onGlobalExitCode((exitCode) => {
|
|
160
173
|
__classPrivateFieldSet(this, _DefaultAllureStore_globalExitCode, exitCode, "f");
|
|
161
174
|
});
|
|
162
|
-
__classPrivateFieldGet(this, _DefaultAllureStore_realtimeSubscriber, "f")?.onGlobalError(
|
|
175
|
+
__classPrivateFieldGet(this, _DefaultAllureStore_realtimeSubscriber, "f")?.onGlobalError((error) => {
|
|
163
176
|
__classPrivateFieldGet(this, _DefaultAllureStore_instances, "m", _DefaultAllureStore_addGlobalError).call(this, error);
|
|
164
177
|
});
|
|
165
|
-
__classPrivateFieldGet(this, _DefaultAllureStore_realtimeSubscriber, "f")?.onGlobalAttachment(
|
|
178
|
+
__classPrivateFieldGet(this, _DefaultAllureStore_realtimeSubscriber, "f")?.onGlobalAttachment(({ attachment, fileName, environment }) => {
|
|
166
179
|
const originalFileName = attachment.getOriginalFileName();
|
|
167
180
|
const resolvedEnvironment = __classPrivateFieldGet(this, _DefaultAllureStore_instances, "m", _DefaultAllureStore_resolveGlobalEnvironmentIdentity).call(this, environment);
|
|
168
181
|
const attachmentLink = {
|
|
@@ -194,6 +207,24 @@ export class DefaultAllureStore {
|
|
|
194
207
|
__classPrivateFieldGet(this, _DefaultAllureStore_historyPoints, "f").push(history);
|
|
195
208
|
await __classPrivateFieldGet(this, _DefaultAllureStore_history, "f").appendHistory(history);
|
|
196
209
|
}
|
|
210
|
+
async addCheckResult(result) {
|
|
211
|
+
__classPrivateFieldGet(this, _DefaultAllureStore_checkResults, "f").push({
|
|
212
|
+
name: result.name,
|
|
213
|
+
status: result.status,
|
|
214
|
+
...(result.tags?.length ? { tags: [...result.tags] } : {}),
|
|
215
|
+
details: {
|
|
216
|
+
command: result.details.command,
|
|
217
|
+
...(result.details.message ? { message: result.details.message } : {}),
|
|
218
|
+
...(result.details.error ? { error: result.details.error } : {}),
|
|
219
|
+
},
|
|
220
|
+
});
|
|
221
|
+
}
|
|
222
|
+
async allCheckResults() {
|
|
223
|
+
return __classPrivateFieldGet(this, _DefaultAllureStore_checkResults, "f").map((result) => ({
|
|
224
|
+
...result,
|
|
225
|
+
...(result.tags ? { tags: [...result.tags] } : {}),
|
|
226
|
+
}));
|
|
227
|
+
}
|
|
197
228
|
async qualityGateResults() {
|
|
198
229
|
return [...__classPrivateFieldGet(this, _DefaultAllureStore_qualityGateResults, "f")];
|
|
199
230
|
}
|
|
@@ -264,6 +295,9 @@ export class DefaultAllureStore {
|
|
|
264
295
|
});
|
|
265
296
|
return result;
|
|
266
297
|
}
|
|
298
|
+
async visitCheckResult(result) {
|
|
299
|
+
await this.addCheckResult(result);
|
|
300
|
+
}
|
|
267
301
|
async visitTestResult(raw, context) {
|
|
268
302
|
const attachmentLinks = [];
|
|
269
303
|
const testResult = testResultRawToState({
|
|
@@ -520,6 +554,17 @@ export class DefaultAllureStore {
|
|
|
520
554
|
async attachmentContentById(attachmentId) {
|
|
521
555
|
return __classPrivateFieldGet(this, _DefaultAllureStore_attachmentContents, "f").get(attachmentId);
|
|
522
556
|
}
|
|
557
|
+
markAttachmentMissed(attachmentId) {
|
|
558
|
+
const attachment = __classPrivateFieldGet(this, _DefaultAllureStore_attachments, "f").get(attachmentId);
|
|
559
|
+
if (!attachment) {
|
|
560
|
+
return;
|
|
561
|
+
}
|
|
562
|
+
const missedAttachment = attachment;
|
|
563
|
+
missedAttachment.missed = true;
|
|
564
|
+
delete missedAttachment.contentLength;
|
|
565
|
+
__classPrivateFieldGet(this, _DefaultAllureStore_attachmentContents, "f").delete(attachmentId);
|
|
566
|
+
__classPrivateFieldGet(this, _DefaultAllureStore_instances, "m", _DefaultAllureStore_relinkRestoredAttachmentSteps).call(this);
|
|
567
|
+
}
|
|
523
568
|
async metadataByKey(key) {
|
|
524
569
|
return __classPrivateFieldGet(this, _DefaultAllureStore_metadata, "f").get(key);
|
|
525
570
|
}
|
|
@@ -749,6 +794,10 @@ export class DefaultAllureStore {
|
|
|
749
794
|
reportVariables: __classPrivateFieldGet(this, _DefaultAllureStore_reportVariables, "f"),
|
|
750
795
|
globalAttachmentIds: __classPrivateFieldGet(this, _DefaultAllureStore_globalAttachmentIds, "f"),
|
|
751
796
|
globalErrors: __classPrivateFieldGet(this, _DefaultAllureStore_globalErrors, "f"),
|
|
797
|
+
checkResults: __classPrivateFieldGet(this, _DefaultAllureStore_checkResults, "f").map((result) => ({
|
|
798
|
+
...result,
|
|
799
|
+
...(result.tags ? { tags: [...result.tags] } : {}),
|
|
800
|
+
})),
|
|
752
801
|
indexLatestEnvTestResultByHistoryId: {},
|
|
753
802
|
indexAttachmentByTestResult: {},
|
|
754
803
|
indexTestResultByHistoryId: {},
|
|
@@ -787,7 +836,7 @@ export class DefaultAllureStore {
|
|
|
787
836
|
return storeDump;
|
|
788
837
|
}
|
|
789
838
|
async restoreState(stateDump, attachmentsContents = {}) {
|
|
790
|
-
const { testResults, attachments, testCases, fixtures, reportVariables, environments, globalAttachmentIds = [], globalErrors = [], indexAttachmentByTestResult = {}, indexTestResultByHistoryId = {}, indexTestResultByTestCase = {}, indexLatestEnvTestResultByHistoryId = {}, indexAttachmentByFixture = {}, indexFixturesByTestResult = {}, indexKnownByHistoryId = {}, qualityGateResults = [], } = stateDump;
|
|
839
|
+
const { testResults, attachments, testCases, fixtures, reportVariables, environments, globalAttachmentIds = [], globalErrors = [], checkResults = [], indexAttachmentByTestResult = {}, indexTestResultByHistoryId = {}, indexTestResultByTestCase = {}, indexLatestEnvTestResultByHistoryId = {}, indexAttachmentByFixture = {}, indexFixturesByTestResult = {}, indexKnownByHistoryId = {}, qualityGateResults = [], } = stateDump;
|
|
791
840
|
const storedEnvironmentAliases = environments.flatMap((environmentValue) => {
|
|
792
841
|
if (typeof environmentValue === "string") {
|
|
793
842
|
return [{ id: environmentValue, name: environmentValue }];
|
|
@@ -846,7 +895,10 @@ export class DefaultAllureStore {
|
|
|
846
895
|
updateMapWithRecord(__classPrivateFieldGet(this, _DefaultAllureStore_attachments, "f"), attachments);
|
|
847
896
|
updateMapWithRecord(__classPrivateFieldGet(this, _DefaultAllureStore_testCases, "f"), testCases);
|
|
848
897
|
updateMapWithRecord(__classPrivateFieldGet(this, _DefaultAllureStore_fixtures, "f"), fixtures);
|
|
849
|
-
|
|
898
|
+
Object.entries(attachmentsContents).forEach(([id, content]) => {
|
|
899
|
+
__classPrivateFieldGet(this, _DefaultAllureStore_instances, "m", _DefaultAllureStore_restoreAttachmentContent).call(this, id, content);
|
|
900
|
+
});
|
|
901
|
+
__classPrivateFieldGet(this, _DefaultAllureStore_instances, "m", _DefaultAllureStore_relinkRestoredAttachmentSteps).call(this);
|
|
850
902
|
globalAttachmentIds.forEach((id) => {
|
|
851
903
|
const attachment = __classPrivateFieldGet(this, _DefaultAllureStore_attachments, "f").get(id);
|
|
852
904
|
if (!attachment) {
|
|
@@ -870,6 +922,18 @@ export class DefaultAllureStore {
|
|
|
870
922
|
});
|
|
871
923
|
__classPrivateFieldGet(this, _DefaultAllureStore_globalErrors, "f").push(__classPrivateFieldGet(this, _DefaultAllureStore_instances, "m", _DefaultAllureStore_indexGlobalError).call(this, error));
|
|
872
924
|
});
|
|
925
|
+
checkResults.forEach((result) => {
|
|
926
|
+
__classPrivateFieldGet(this, _DefaultAllureStore_checkResults, "f").push({
|
|
927
|
+
name: result.name,
|
|
928
|
+
status: result.status,
|
|
929
|
+
...(result.tags?.length ? { tags: [...result.tags] } : {}),
|
|
930
|
+
details: {
|
|
931
|
+
command: result.details?.command ?? "",
|
|
932
|
+
...(result.details?.message ? { message: result.details.message } : {}),
|
|
933
|
+
...(result.details?.error ? { error: result.details.error } : {}),
|
|
934
|
+
},
|
|
935
|
+
});
|
|
936
|
+
});
|
|
873
937
|
Object.assign(__classPrivateFieldGet(this, _DefaultAllureStore_reportVariables, "f"), reportVariables);
|
|
874
938
|
Object.entries(indexAttachmentByTestResult).forEach(([trId, links]) => {
|
|
875
939
|
const attachmentsLinks = links.map((id) => __classPrivateFieldGet(this, _DefaultAllureStore_attachments, "f").get(id)).filter(Boolean);
|
|
@@ -1000,7 +1064,7 @@ export class DefaultAllureStore {
|
|
|
1000
1064
|
});
|
|
1001
1065
|
}
|
|
1002
1066
|
}
|
|
1003
|
-
_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_qualityGateResults = new WeakMap(), _DefaultAllureStore_historyPoints = new WeakMap(), _DefaultAllureStore_environments = new WeakMap(), _DefaultAllureStore_instances = new WeakSet(), _DefaultAllureStore_mergeEnvironmentIdentity = function _DefaultAllureStore_mergeEnvironmentIdentity(existingEnvironment, incomingEnvironment) {
|
|
1067
|
+
_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) {
|
|
1004
1068
|
const configuredEnvironment = environmentIdentityById(__classPrivateFieldGet(this, _DefaultAllureStore_environmentsConfig, "f"), incomingEnvironment.id);
|
|
1005
1069
|
if (configuredEnvironment) {
|
|
1006
1070
|
return configuredEnvironment;
|
|
@@ -1142,4 +1206,23 @@ _DefaultAllureStore_testResults = new WeakMap(), _DefaultAllureStore_environment
|
|
|
1142
1206
|
__classPrivateFieldGet(this, _DefaultAllureStore_attachmentContents, "f").set(indexedAttachment.id, attachment);
|
|
1143
1207
|
}
|
|
1144
1208
|
__classPrivateFieldGet(this, _DefaultAllureStore_globalAttachmentIds, "f").push(indexedAttachment.id);
|
|
1209
|
+
}, _DefaultAllureStore_restoreAttachmentContent = function _DefaultAllureStore_restoreAttachmentContent(id, content) {
|
|
1210
|
+
const attachment = __classPrivateFieldGet(this, _DefaultAllureStore_attachments, "f").get(id);
|
|
1211
|
+
__classPrivateFieldGet(this, _DefaultAllureStore_attachmentContents, "f").set(id, content);
|
|
1212
|
+
if (!attachment) {
|
|
1213
|
+
return;
|
|
1214
|
+
}
|
|
1215
|
+
const linkedAttachment = attachment;
|
|
1216
|
+
linkedAttachment.missed = false;
|
|
1217
|
+
linkedAttachment.contentType = linkedAttachment.contentType ?? content.getContentType();
|
|
1218
|
+
linkedAttachment.contentLength = content.getContentLength();
|
|
1219
|
+
linkedAttachment.ext =
|
|
1220
|
+
linkedAttachment.ext === undefined || linkedAttachment.ext === "" ? content.getExtension() : linkedAttachment.ext;
|
|
1221
|
+
}, _DefaultAllureStore_relinkRestoredAttachmentSteps = function _DefaultAllureStore_relinkRestoredAttachmentSteps() {
|
|
1222
|
+
__classPrivateFieldGet(this, _DefaultAllureStore_testResults, "f").forEach(({ steps }) => {
|
|
1223
|
+
relinkAttachmentSteps(steps, __classPrivateFieldGet(this, _DefaultAllureStore_attachments, "f"));
|
|
1224
|
+
});
|
|
1225
|
+
__classPrivateFieldGet(this, _DefaultAllureStore_fixtures, "f").forEach(({ steps }) => {
|
|
1226
|
+
relinkAttachmentSteps(steps, __classPrivateFieldGet(this, _DefaultAllureStore_attachments, "f"));
|
|
1227
|
+
});
|
|
1145
1228
|
};
|
package/dist/utils/event.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import
|
|
2
|
-
import type { BatchOptions, ExitCode, PluginGlobalError, QualityGateValidationResult, RealtimeEventsDispatcher as RealtimeEventsDispatcherType, RealtimeSubscriber as RealtimeSubscriberType, ResultFile } from "@allurereport/plugin-api";
|
|
1
|
+
import { EventEmitter } from "node:events";
|
|
2
|
+
import type { BatchOptions, ExitCode, PluginGlobalError, QualityGateValidationResult, RealtimeEventsDispatcher as RealtimeEventsDispatcherType, RealtimeListenerResult, RealtimeSubscriber as RealtimeSubscriberType, ResultFile } from "@allurereport/plugin-api";
|
|
3
3
|
export declare enum RealtimeEvents {
|
|
4
4
|
TestResult = "testResult",
|
|
5
5
|
TestFixtureResult = "testFixtureResult",
|
|
@@ -40,13 +40,12 @@ export declare class RealtimeSubscriber implements RealtimeSubscriberType {
|
|
|
40
40
|
attachment: ResultFile;
|
|
41
41
|
fileName?: string;
|
|
42
42
|
environment?: string;
|
|
43
|
-
}) =>
|
|
44
|
-
onGlobalExitCode(listener: (payload: ExitCode) =>
|
|
45
|
-
onGlobalError(listener: (error: PluginGlobalError) =>
|
|
46
|
-
onQualityGateResults(listener: (payload: QualityGateValidationResult[]) =>
|
|
47
|
-
onTestResults(listener: (trIds: string[]) =>
|
|
48
|
-
onTestFixtureResults(listener: (tfrIds: string[]) =>
|
|
49
|
-
onAttachmentFiles(listener: (afIds: string[]) =>
|
|
50
|
-
onAll(listener: () => Promise<void>, options?: BatchOptions): () => void;
|
|
43
|
+
}) => RealtimeListenerResult): () => void;
|
|
44
|
+
onGlobalExitCode(listener: (payload: ExitCode) => RealtimeListenerResult): () => void;
|
|
45
|
+
onGlobalError(listener: (error: PluginGlobalError) => RealtimeListenerResult): () => void;
|
|
46
|
+
onQualityGateResults(listener: (payload: QualityGateValidationResult[]) => RealtimeListenerResult): () => void;
|
|
47
|
+
onTestResults(listener: (trIds: string[]) => RealtimeListenerResult, options?: BatchOptions): () => void;
|
|
48
|
+
onTestFixtureResults(listener: (tfrIds: string[]) => RealtimeListenerResult, options?: BatchOptions): () => void;
|
|
49
|
+
onAttachmentFiles(listener: (afIds: string[]) => RealtimeListenerResult, options?: BatchOptions): () => void;
|
|
51
50
|
offAll(): void;
|
|
52
51
|
}
|
package/dist/utils/event.js
CHANGED
|
@@ -9,7 +9,7 @@ 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 _RealtimeEventsDispatcher_emitter, _RealtimeSubscriber_instances, _RealtimeSubscriber_emitter, _RealtimeSubscriber_handlers, _RealtimeSubscriber_createBatchHandler;
|
|
12
|
+
var _RealtimeEventsDispatcher_emitter, _RealtimeSubscriber_instances, _RealtimeSubscriber_emitter, _RealtimeSubscriber_handlers, _RealtimeSubscriber_onEvent, _RealtimeSubscriber_onBatchedEvent, _RealtimeSubscriber_createBatchHandler, _RealtimeSubscriber_runBatchHandler, _RealtimeSubscriber_disposeBatchHandler;
|
|
13
13
|
import console from "node:console";
|
|
14
14
|
import { setTimeout } from "node:timers/promises";
|
|
15
15
|
export var RealtimeEvents;
|
|
@@ -22,6 +22,20 @@ export var RealtimeEvents;
|
|
|
22
22
|
RealtimeEvents["GlobalError"] = "globalError";
|
|
23
23
|
RealtimeEvents["GlobalExitCode"] = "globalExitCode";
|
|
24
24
|
})(RealtimeEvents || (RealtimeEvents = {}));
|
|
25
|
+
const runListener = (listener, ...args) => {
|
|
26
|
+
try {
|
|
27
|
+
return Promise.resolve(listener(...args)).catch((err) => {
|
|
28
|
+
console.error("can't execute listener", err);
|
|
29
|
+
});
|
|
30
|
+
}
|
|
31
|
+
catch (err) {
|
|
32
|
+
console.error("can't execute listener", err);
|
|
33
|
+
return Promise.resolve();
|
|
34
|
+
}
|
|
35
|
+
};
|
|
36
|
+
const createListenerHandler = (listener) => (...args) => {
|
|
37
|
+
void runListener(listener, ...args);
|
|
38
|
+
};
|
|
25
39
|
export class RealtimeEventsDispatcher {
|
|
26
40
|
constructor(emitter) {
|
|
27
41
|
_RealtimeEventsDispatcher_emitter.set(this, void 0);
|
|
@@ -58,97 +72,95 @@ export class RealtimeSubscriber {
|
|
|
58
72
|
__classPrivateFieldSet(this, _RealtimeSubscriber_emitter, emitter, "f");
|
|
59
73
|
}
|
|
60
74
|
onGlobalAttachment(listener) {
|
|
61
|
-
__classPrivateFieldGet(this,
|
|
62
|
-
return () => {
|
|
63
|
-
__classPrivateFieldGet(this, _RealtimeSubscriber_emitter, "f").off(RealtimeEvents.GlobalAttachment, listener);
|
|
64
|
-
};
|
|
75
|
+
return __classPrivateFieldGet(this, _RealtimeSubscriber_instances, "m", _RealtimeSubscriber_onEvent).call(this, RealtimeEvents.GlobalAttachment, listener);
|
|
65
76
|
}
|
|
66
77
|
onGlobalExitCode(listener) {
|
|
67
|
-
__classPrivateFieldGet(this,
|
|
68
|
-
return () => {
|
|
69
|
-
__classPrivateFieldGet(this, _RealtimeSubscriber_emitter, "f").off(RealtimeEvents.GlobalExitCode, listener);
|
|
70
|
-
};
|
|
78
|
+
return __classPrivateFieldGet(this, _RealtimeSubscriber_instances, "m", _RealtimeSubscriber_onEvent).call(this, RealtimeEvents.GlobalExitCode, listener);
|
|
71
79
|
}
|
|
72
80
|
onGlobalError(listener) {
|
|
73
|
-
__classPrivateFieldGet(this,
|
|
74
|
-
return () => {
|
|
75
|
-
__classPrivateFieldGet(this, _RealtimeSubscriber_emitter, "f").off(RealtimeEvents.GlobalError, listener);
|
|
76
|
-
};
|
|
81
|
+
return __classPrivateFieldGet(this, _RealtimeSubscriber_instances, "m", _RealtimeSubscriber_onEvent).call(this, RealtimeEvents.GlobalError, listener);
|
|
77
82
|
}
|
|
78
83
|
onQualityGateResults(listener) {
|
|
79
|
-
__classPrivateFieldGet(this,
|
|
80
|
-
return () => {
|
|
81
|
-
__classPrivateFieldGet(this, _RealtimeSubscriber_emitter, "f").off(RealtimeEvents.QualityGateResults, listener);
|
|
82
|
-
};
|
|
84
|
+
return __classPrivateFieldGet(this, _RealtimeSubscriber_instances, "m", _RealtimeSubscriber_onEvent).call(this, RealtimeEvents.QualityGateResults, listener);
|
|
83
85
|
}
|
|
84
86
|
onTestResults(listener, options = {}) {
|
|
85
|
-
|
|
86
|
-
const handler = __classPrivateFieldGet(this, _RealtimeSubscriber_instances, "m", _RealtimeSubscriber_createBatchHandler).call(this, maxTimeout, listener);
|
|
87
|
-
__classPrivateFieldGet(this, _RealtimeSubscriber_emitter, "f").on(RealtimeEvents.TestResult, handler);
|
|
88
|
-
return () => {
|
|
89
|
-
__classPrivateFieldGet(this, _RealtimeSubscriber_emitter, "f").off(RealtimeEvents.TestResult, handler);
|
|
90
|
-
};
|
|
87
|
+
return __classPrivateFieldGet(this, _RealtimeSubscriber_instances, "m", _RealtimeSubscriber_onBatchedEvent).call(this, RealtimeEvents.TestResult, listener, options);
|
|
91
88
|
}
|
|
92
89
|
onTestFixtureResults(listener, options = {}) {
|
|
93
|
-
|
|
94
|
-
const handler = __classPrivateFieldGet(this, _RealtimeSubscriber_instances, "m", _RealtimeSubscriber_createBatchHandler).call(this, maxTimeout, listener);
|
|
95
|
-
__classPrivateFieldGet(this, _RealtimeSubscriber_emitter, "f").on(RealtimeEvents.TestFixtureResult, handler);
|
|
96
|
-
return () => {
|
|
97
|
-
__classPrivateFieldGet(this, _RealtimeSubscriber_emitter, "f").off(RealtimeEvents.TestFixtureResult, handler);
|
|
98
|
-
};
|
|
90
|
+
return __classPrivateFieldGet(this, _RealtimeSubscriber_instances, "m", _RealtimeSubscriber_onBatchedEvent).call(this, RealtimeEvents.TestFixtureResult, listener, options);
|
|
99
91
|
}
|
|
100
92
|
onAttachmentFiles(listener, options = {}) {
|
|
101
|
-
|
|
102
|
-
const handler = __classPrivateFieldGet(this, _RealtimeSubscriber_instances, "m", _RealtimeSubscriber_createBatchHandler).call(this, maxTimeout, listener);
|
|
103
|
-
__classPrivateFieldGet(this, _RealtimeSubscriber_emitter, "f").on(RealtimeEvents.AttachmentFile, handler);
|
|
104
|
-
return () => {
|
|
105
|
-
__classPrivateFieldGet(this, _RealtimeSubscriber_emitter, "f").off(RealtimeEvents.AttachmentFile, handler);
|
|
106
|
-
};
|
|
107
|
-
}
|
|
108
|
-
onAll(listener, options = {}) {
|
|
109
|
-
const { maxTimeout = 100 } = options;
|
|
110
|
-
const handler = __classPrivateFieldGet(this, _RealtimeSubscriber_instances, "m", _RealtimeSubscriber_createBatchHandler).call(this, maxTimeout, listener);
|
|
111
|
-
__classPrivateFieldGet(this, _RealtimeSubscriber_emitter, "f").on(RealtimeEvents.TestResult, handler);
|
|
112
|
-
__classPrivateFieldGet(this, _RealtimeSubscriber_emitter, "f").on(RealtimeEvents.TestFixtureResult, handler);
|
|
113
|
-
__classPrivateFieldGet(this, _RealtimeSubscriber_emitter, "f").on(RealtimeEvents.AttachmentFile, handler);
|
|
114
|
-
return () => {
|
|
115
|
-
__classPrivateFieldGet(this, _RealtimeSubscriber_emitter, "f").off(RealtimeEvents.TestResult, handler);
|
|
116
|
-
__classPrivateFieldGet(this, _RealtimeSubscriber_emitter, "f").off(RealtimeEvents.TestFixtureResult, handler);
|
|
117
|
-
__classPrivateFieldGet(this, _RealtimeSubscriber_emitter, "f").off(RealtimeEvents.AttachmentFile, handler);
|
|
118
|
-
};
|
|
93
|
+
return __classPrivateFieldGet(this, _RealtimeSubscriber_instances, "m", _RealtimeSubscriber_onBatchedEvent).call(this, RealtimeEvents.AttachmentFile, listener, options);
|
|
119
94
|
}
|
|
120
95
|
offAll() {
|
|
121
96
|
__classPrivateFieldGet(this, _RealtimeSubscriber_emitter, "f").removeAllListeners();
|
|
122
97
|
for (const handler of __classPrivateFieldGet(this, _RealtimeSubscriber_handlers, "f")) {
|
|
123
|
-
|
|
98
|
+
__classPrivateFieldGet(this, _RealtimeSubscriber_instances, "m", _RealtimeSubscriber_disposeBatchHandler).call(this, handler);
|
|
124
99
|
}
|
|
125
100
|
__classPrivateFieldSet(this, _RealtimeSubscriber_handlers, [], "f");
|
|
126
101
|
}
|
|
127
102
|
}
|
|
128
|
-
_RealtimeSubscriber_emitter = new WeakMap(), _RealtimeSubscriber_handlers = new WeakMap(), _RealtimeSubscriber_instances = new WeakSet(),
|
|
103
|
+
_RealtimeSubscriber_emitter = new WeakMap(), _RealtimeSubscriber_handlers = new WeakMap(), _RealtimeSubscriber_instances = new WeakSet(), _RealtimeSubscriber_onEvent = function _RealtimeSubscriber_onEvent(event, listener) {
|
|
104
|
+
const handler = createListenerHandler(listener);
|
|
105
|
+
__classPrivateFieldGet(this, _RealtimeSubscriber_emitter, "f").on(event, handler);
|
|
106
|
+
return () => {
|
|
107
|
+
__classPrivateFieldGet(this, _RealtimeSubscriber_emitter, "f").off(event, handler);
|
|
108
|
+
};
|
|
109
|
+
}, _RealtimeSubscriber_onBatchedEvent = function _RealtimeSubscriber_onBatchedEvent(event, listener, options) {
|
|
110
|
+
const { maxTimeout = 100 } = options;
|
|
111
|
+
const { dispose, eventHandler } = __classPrivateFieldGet(this, _RealtimeSubscriber_instances, "m", _RealtimeSubscriber_createBatchHandler).call(this, maxTimeout, listener);
|
|
112
|
+
__classPrivateFieldGet(this, _RealtimeSubscriber_emitter, "f").on(event, eventHandler);
|
|
113
|
+
return () => {
|
|
114
|
+
__classPrivateFieldGet(this, _RealtimeSubscriber_emitter, "f").off(event, eventHandler);
|
|
115
|
+
dispose();
|
|
116
|
+
};
|
|
117
|
+
}, _RealtimeSubscriber_createBatchHandler = function _RealtimeSubscriber_createBatchHandler(maxTimeout, listener) {
|
|
129
118
|
const handler = {
|
|
130
119
|
buffer: [],
|
|
120
|
+
closed: false,
|
|
131
121
|
};
|
|
132
122
|
__classPrivateFieldGet(this, _RealtimeSubscriber_handlers, "f").push(handler);
|
|
133
|
-
|
|
123
|
+
const eventHandler = (trId) => {
|
|
124
|
+
if (handler.closed) {
|
|
125
|
+
return;
|
|
126
|
+
}
|
|
134
127
|
handler.buffer.push(trId);
|
|
135
|
-
if (handler.
|
|
128
|
+
if (handler.cycle) {
|
|
136
129
|
return;
|
|
137
130
|
}
|
|
138
|
-
handler.
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
131
|
+
handler.cycle = __classPrivateFieldGet(this, _RealtimeSubscriber_instances, "m", _RealtimeSubscriber_runBatchHandler).call(this, handler, maxTimeout, listener);
|
|
132
|
+
};
|
|
133
|
+
return {
|
|
134
|
+
dispose: () => __classPrivateFieldGet(this, _RealtimeSubscriber_instances, "m", _RealtimeSubscriber_disposeBatchHandler).call(this, handler),
|
|
135
|
+
eventHandler,
|
|
136
|
+
};
|
|
137
|
+
}, _RealtimeSubscriber_runBatchHandler = async function _RealtimeSubscriber_runBatchHandler(handler, maxTimeout, listener) {
|
|
138
|
+
try {
|
|
139
|
+
while (!handler.closed && handler.buffer.length > 0) {
|
|
140
|
+
handler.abortController = new AbortController();
|
|
141
|
+
await setTimeout(maxTimeout, undefined, { signal: handler.abortController.signal });
|
|
142
|
+
handler.abortController = undefined;
|
|
142
143
|
const bufferCopy = [...handler.buffer];
|
|
143
144
|
handler.buffer = [];
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
}
|
|
145
|
+
await runListener(listener, bufferCopy);
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
catch (err) {
|
|
149
|
+
if (err.name === "AbortError") {
|
|
150
|
+
return;
|
|
151
|
+
}
|
|
152
|
+
handler.buffer = [];
|
|
153
|
+
console.error("can't execute listener", err);
|
|
154
|
+
}
|
|
155
|
+
finally {
|
|
156
|
+
handler.abortController = undefined;
|
|
157
|
+
handler.cycle = undefined;
|
|
158
|
+
}
|
|
159
|
+
}, _RealtimeSubscriber_disposeBatchHandler = function _RealtimeSubscriber_disposeBatchHandler(handler) {
|
|
160
|
+
handler.closed = true;
|
|
161
|
+
handler.abortController?.abort();
|
|
162
|
+
handler.abortController = undefined;
|
|
163
|
+
handler.buffer = [];
|
|
164
|
+
handler.cycle = undefined;
|
|
165
|
+
__classPrivateFieldSet(this, _RealtimeSubscriber_handlers, __classPrivateFieldGet(this, _RealtimeSubscriber_handlers, "f").filter((registeredHandler) => registeredHandler !== handler), "f");
|
|
154
166
|
};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { RealtimeEventsDispatcher, RealtimeSubscriber } from "./event.js";
|
|
2
|
+
export declare class RealtimeChannel {
|
|
3
|
+
#private;
|
|
4
|
+
readonly dispatcher: RealtimeEventsDispatcher;
|
|
5
|
+
readonly subscriber: RealtimeSubscriber;
|
|
6
|
+
onResultLikeChanged(listener: () => void): () => void;
|
|
7
|
+
close(): void;
|
|
8
|
+
}
|
|
@@ -0,0 +1,29 @@
|
|
|
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 _RealtimeChannel_emitter;
|
|
7
|
+
import { EventEmitter } from "node:events";
|
|
8
|
+
import { RealtimeEvents, RealtimeEventsDispatcher, RealtimeSubscriber } from "./event.js";
|
|
9
|
+
export class RealtimeChannel {
|
|
10
|
+
constructor() {
|
|
11
|
+
_RealtimeChannel_emitter.set(this, new EventEmitter());
|
|
12
|
+
this.dispatcher = new RealtimeEventsDispatcher(__classPrivateFieldGet(this, _RealtimeChannel_emitter, "f"));
|
|
13
|
+
this.subscriber = new RealtimeSubscriber(__classPrivateFieldGet(this, _RealtimeChannel_emitter, "f"));
|
|
14
|
+
}
|
|
15
|
+
onResultLikeChanged(listener) {
|
|
16
|
+
__classPrivateFieldGet(this, _RealtimeChannel_emitter, "f").on(RealtimeEvents.TestResult, listener);
|
|
17
|
+
__classPrivateFieldGet(this, _RealtimeChannel_emitter, "f").on(RealtimeEvents.TestFixtureResult, listener);
|
|
18
|
+
__classPrivateFieldGet(this, _RealtimeChannel_emitter, "f").on(RealtimeEvents.AttachmentFile, listener);
|
|
19
|
+
return () => {
|
|
20
|
+
__classPrivateFieldGet(this, _RealtimeChannel_emitter, "f").off(RealtimeEvents.TestResult, listener);
|
|
21
|
+
__classPrivateFieldGet(this, _RealtimeChannel_emitter, "f").off(RealtimeEvents.TestFixtureResult, listener);
|
|
22
|
+
__classPrivateFieldGet(this, _RealtimeChannel_emitter, "f").off(RealtimeEvents.AttachmentFile, listener);
|
|
23
|
+
};
|
|
24
|
+
}
|
|
25
|
+
close() {
|
|
26
|
+
this.subscriber.offAll();
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
_RealtimeChannel_emitter = new WeakMap();
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export interface RealtimeUpdateSchedulerOptions {
|
|
2
|
+
cooldownMs?: number;
|
|
3
|
+
}
|
|
4
|
+
export declare class RealtimeUpdateScheduler {
|
|
5
|
+
#private;
|
|
6
|
+
constructor(worker: () => Promise<void>, options?: RealtimeUpdateSchedulerOptions);
|
|
7
|
+
request(): void;
|
|
8
|
+
flush(): Promise<void>;
|
|
9
|
+
close(): Promise<void>;
|
|
10
|
+
}
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
|
|
2
|
+
if (kind === "m") throw new TypeError("Private method is not writable");
|
|
3
|
+
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
|
|
4
|
+
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
|
|
5
|
+
return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
|
|
6
|
+
};
|
|
7
|
+
var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) {
|
|
8
|
+
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
|
|
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
|
+
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
|
11
|
+
};
|
|
12
|
+
var _RealtimeUpdateScheduler_instances, _RealtimeUpdateScheduler_worker, _RealtimeUpdateScheduler_cooldownMs, _RealtimeUpdateScheduler_closed, _RealtimeUpdateScheduler_dirty, _RealtimeUpdateScheduler_phase, _RealtimeUpdateScheduler_cycle, _RealtimeUpdateScheduler_failed, _RealtimeUpdateScheduler_failure, _RealtimeUpdateScheduler_startCycle, _RealtimeUpdateScheduler_runCycle;
|
|
13
|
+
import { setTimeout } from "node:timers/promises";
|
|
14
|
+
export class RealtimeUpdateScheduler {
|
|
15
|
+
constructor(worker, options = {}) {
|
|
16
|
+
_RealtimeUpdateScheduler_instances.add(this);
|
|
17
|
+
_RealtimeUpdateScheduler_worker.set(this, void 0);
|
|
18
|
+
_RealtimeUpdateScheduler_cooldownMs.set(this, void 0);
|
|
19
|
+
_RealtimeUpdateScheduler_closed.set(this, false);
|
|
20
|
+
_RealtimeUpdateScheduler_dirty.set(this, false);
|
|
21
|
+
_RealtimeUpdateScheduler_phase.set(this, "idle");
|
|
22
|
+
_RealtimeUpdateScheduler_cycle.set(this, void 0);
|
|
23
|
+
_RealtimeUpdateScheduler_failed.set(this, false);
|
|
24
|
+
_RealtimeUpdateScheduler_failure.set(this, void 0);
|
|
25
|
+
_RealtimeUpdateScheduler_runCycle.set(this, async () => {
|
|
26
|
+
do {
|
|
27
|
+
__classPrivateFieldSet(this, _RealtimeUpdateScheduler_phase, "scheduled", "f");
|
|
28
|
+
await setTimeout(__classPrivateFieldGet(this, _RealtimeUpdateScheduler_cooldownMs, "f"));
|
|
29
|
+
__classPrivateFieldSet(this, _RealtimeUpdateScheduler_phase, "running", "f");
|
|
30
|
+
__classPrivateFieldSet(this, _RealtimeUpdateScheduler_dirty, false, "f");
|
|
31
|
+
await __classPrivateFieldGet(this, _RealtimeUpdateScheduler_worker, "f").call(this);
|
|
32
|
+
} while (__classPrivateFieldGet(this, _RealtimeUpdateScheduler_dirty, "f"));
|
|
33
|
+
});
|
|
34
|
+
__classPrivateFieldSet(this, _RealtimeUpdateScheduler_worker, worker, "f");
|
|
35
|
+
__classPrivateFieldSet(this, _RealtimeUpdateScheduler_cooldownMs, options.cooldownMs ?? 100, "f");
|
|
36
|
+
}
|
|
37
|
+
request() {
|
|
38
|
+
if (__classPrivateFieldGet(this, _RealtimeUpdateScheduler_closed, "f")) {
|
|
39
|
+
return;
|
|
40
|
+
}
|
|
41
|
+
if (__classPrivateFieldGet(this, _RealtimeUpdateScheduler_phase, "f") === "running") {
|
|
42
|
+
__classPrivateFieldSet(this, _RealtimeUpdateScheduler_dirty, true, "f");
|
|
43
|
+
return;
|
|
44
|
+
}
|
|
45
|
+
if (__classPrivateFieldGet(this, _RealtimeUpdateScheduler_phase, "f") === "idle") {
|
|
46
|
+
__classPrivateFieldGet(this, _RealtimeUpdateScheduler_instances, "m", _RealtimeUpdateScheduler_startCycle).call(this);
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
async flush() {
|
|
50
|
+
await __classPrivateFieldGet(this, _RealtimeUpdateScheduler_cycle, "f");
|
|
51
|
+
if (__classPrivateFieldGet(this, _RealtimeUpdateScheduler_failed, "f")) {
|
|
52
|
+
throw __classPrivateFieldGet(this, _RealtimeUpdateScheduler_failure, "f");
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
async close() {
|
|
56
|
+
__classPrivateFieldSet(this, _RealtimeUpdateScheduler_closed, true, "f");
|
|
57
|
+
await this.flush();
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
_RealtimeUpdateScheduler_worker = new WeakMap(), _RealtimeUpdateScheduler_cooldownMs = new WeakMap(), _RealtimeUpdateScheduler_closed = new WeakMap(), _RealtimeUpdateScheduler_dirty = new WeakMap(), _RealtimeUpdateScheduler_phase = new WeakMap(), _RealtimeUpdateScheduler_cycle = new WeakMap(), _RealtimeUpdateScheduler_failed = new WeakMap(), _RealtimeUpdateScheduler_failure = new WeakMap(), _RealtimeUpdateScheduler_runCycle = new WeakMap(), _RealtimeUpdateScheduler_instances = new WeakSet(), _RealtimeUpdateScheduler_startCycle = function _RealtimeUpdateScheduler_startCycle() {
|
|
61
|
+
if (__classPrivateFieldGet(this, _RealtimeUpdateScheduler_phase, "f") !== "idle") {
|
|
62
|
+
return;
|
|
63
|
+
}
|
|
64
|
+
__classPrivateFieldSet(this, _RealtimeUpdateScheduler_failed, false, "f");
|
|
65
|
+
__classPrivateFieldSet(this, _RealtimeUpdateScheduler_failure, undefined, "f");
|
|
66
|
+
__classPrivateFieldSet(this, _RealtimeUpdateScheduler_dirty, false, "f");
|
|
67
|
+
const cycle = __classPrivateFieldGet(this, _RealtimeUpdateScheduler_runCycle, "f").call(this)
|
|
68
|
+
.catch((err) => {
|
|
69
|
+
__classPrivateFieldSet(this, _RealtimeUpdateScheduler_failed, true, "f");
|
|
70
|
+
__classPrivateFieldSet(this, _RealtimeUpdateScheduler_failure, err, "f");
|
|
71
|
+
throw err;
|
|
72
|
+
})
|
|
73
|
+
.finally(() => {
|
|
74
|
+
if (__classPrivateFieldGet(this, _RealtimeUpdateScheduler_cycle, "f") === cycle) {
|
|
75
|
+
__classPrivateFieldSet(this, _RealtimeUpdateScheduler_cycle, undefined, "f");
|
|
76
|
+
__classPrivateFieldSet(this, _RealtimeUpdateScheduler_phase, "idle", "f");
|
|
77
|
+
}
|
|
78
|
+
});
|
|
79
|
+
cycle.catch(() => { });
|
|
80
|
+
__classPrivateFieldSet(this, _RealtimeUpdateScheduler_cycle, cycle, "f");
|
|
81
|
+
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@allurereport/core",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.8.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.8.0",
|
|
29
|
+
"@allurereport/core-api": "3.8.0",
|
|
30
|
+
"@allurereport/plugin-agent": "3.8.0",
|
|
31
|
+
"@allurereport/plugin-allure2": "3.8.0",
|
|
32
|
+
"@allurereport/plugin-api": "3.8.0",
|
|
33
|
+
"@allurereport/plugin-awesome": "3.8.0",
|
|
34
|
+
"@allurereport/plugin-classic": "3.8.0",
|
|
35
|
+
"@allurereport/plugin-csv": "3.8.0",
|
|
36
|
+
"@allurereport/plugin-dashboard": "3.8.0",
|
|
37
|
+
"@allurereport/plugin-jira": "3.8.0",
|
|
38
|
+
"@allurereport/plugin-log": "3.8.0",
|
|
39
|
+
"@allurereport/plugin-progress": "3.8.0",
|
|
40
|
+
"@allurereport/plugin-slack": "3.8.0",
|
|
41
|
+
"@allurereport/plugin-testops": "3.8.0",
|
|
42
|
+
"@allurereport/plugin-testplan": "3.8.0",
|
|
43
|
+
"@allurereport/reader": "3.8.0",
|
|
44
|
+
"@allurereport/reader-api": "3.8.0",
|
|
45
|
+
"@allurereport/service": "3.8.0",
|
|
46
|
+
"@allurereport/summary": "3.8.0",
|
|
47
47
|
"glob": "^13.0.6",
|
|
48
48
|
"handlebars": "^4.7.9",
|
|
49
49
|
"node-stream-zip": "^1.15.0",
|