@allurereport/core 3.0.0-beta.3
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/README.md +25 -0
- package/dist/api.d.ts +22 -0
- package/dist/api.js +1 -0
- package/dist/config.d.ts +22 -0
- package/dist/config.js +92 -0
- package/dist/history.d.ts +4 -0
- package/dist/history.js +58 -0
- package/dist/index.d.ts +9 -0
- package/dist/index.js +9 -0
- package/dist/known.d.ts +4 -0
- package/dist/known.js +32 -0
- package/dist/plugin.d.ts +22 -0
- package/dist/plugin.js +64 -0
- package/dist/qualityGate.d.ts +25 -0
- package/dist/qualityGate.js +116 -0
- package/dist/report.d.ts +16 -0
- package/dist/report.js +188 -0
- package/dist/store/convert.d.ts +10 -0
- package/dist/store/convert.js +254 -0
- package/dist/store/store.d.ts +49 -0
- package/dist/store/store.js +240 -0
- package/dist/utils/crypto.d.ts +1 -0
- package/dist/utils/crypto.js +2 -0
- package/dist/utils/event.d.ts +16 -0
- package/dist/utils/event.js +78 -0
- package/dist/utils/misc.d.ts +1 -0
- package/dist/utils/misc.js +1 -0
- package/dist/utils/module.d.ts +1 -0
- package/dist/utils/module.js +3 -0
- package/package.json +62 -0
|
@@ -0,0 +1,240 @@
|
|
|
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 _DefaultAllureStore_testResults, _DefaultAllureStore_attachments, _DefaultAllureStore_attachmentContents, _DefaultAllureStore_testCases, _DefaultAllureStore_metadata, _DefaultAllureStore_history, _DefaultAllureStore_known, _DefaultAllureStore_fixtures, _DefaultAllureStore_eventEmitter;
|
|
13
|
+
import { compareBy, nullsLast, ordinal, reverse, } from "@allurereport/core-api";
|
|
14
|
+
import { md5 } from "@allurereport/plugin-api";
|
|
15
|
+
import { extname } from "node:path";
|
|
16
|
+
import { testFixtureResultRawToState, testResultRawToState } from "./convert.js";
|
|
17
|
+
const index = (indexMap, key, ...items) => {
|
|
18
|
+
if (key) {
|
|
19
|
+
if (!indexMap.has(key)) {
|
|
20
|
+
indexMap.set(key, []);
|
|
21
|
+
}
|
|
22
|
+
const current = indexMap.get(key);
|
|
23
|
+
current.push(...items);
|
|
24
|
+
}
|
|
25
|
+
};
|
|
26
|
+
export class DefaultAllureStore {
|
|
27
|
+
constructor(history = [], known = [], eventEmitter) {
|
|
28
|
+
_DefaultAllureStore_testResults.set(this, void 0);
|
|
29
|
+
_DefaultAllureStore_attachments.set(this, void 0);
|
|
30
|
+
_DefaultAllureStore_attachmentContents.set(this, void 0);
|
|
31
|
+
_DefaultAllureStore_testCases.set(this, void 0);
|
|
32
|
+
_DefaultAllureStore_metadata.set(this, void 0);
|
|
33
|
+
_DefaultAllureStore_history.set(this, void 0);
|
|
34
|
+
_DefaultAllureStore_known.set(this, void 0);
|
|
35
|
+
_DefaultAllureStore_fixtures.set(this, void 0);
|
|
36
|
+
_DefaultAllureStore_eventEmitter.set(this, void 0);
|
|
37
|
+
this.indexTestResultByTestCase = new Map();
|
|
38
|
+
this.indexLatestTestResultByHistoryId = new Map();
|
|
39
|
+
this.indexTestResultByHistoryId = new Map();
|
|
40
|
+
this.indexAttachmentByTestResult = new Map();
|
|
41
|
+
this.indexAttachmentByFixture = new Map();
|
|
42
|
+
this.indexFixturesByTestResult = new Map();
|
|
43
|
+
this.indexKnownByHistoryId = new Map();
|
|
44
|
+
__classPrivateFieldSet(this, _DefaultAllureStore_testResults, new Map(), "f");
|
|
45
|
+
__classPrivateFieldSet(this, _DefaultAllureStore_attachments, new Map(), "f");
|
|
46
|
+
__classPrivateFieldSet(this, _DefaultAllureStore_attachmentContents, new Map(), "f");
|
|
47
|
+
__classPrivateFieldSet(this, _DefaultAllureStore_testCases, new Map(), "f");
|
|
48
|
+
__classPrivateFieldSet(this, _DefaultAllureStore_metadata, new Map(), "f");
|
|
49
|
+
__classPrivateFieldSet(this, _DefaultAllureStore_fixtures, new Map(), "f");
|
|
50
|
+
__classPrivateFieldSet(this, _DefaultAllureStore_history, [...history].sort(compareBy("timestamp", reverse(ordinal()))), "f");
|
|
51
|
+
__classPrivateFieldSet(this, _DefaultAllureStore_known, [...known], "f");
|
|
52
|
+
__classPrivateFieldGet(this, _DefaultAllureStore_known, "f").forEach((ktf) => index(this.indexKnownByHistoryId, ktf.historyId, ktf));
|
|
53
|
+
__classPrivateFieldSet(this, _DefaultAllureStore_eventEmitter, eventEmitter, "f");
|
|
54
|
+
}
|
|
55
|
+
async visitTestResult(raw, context) {
|
|
56
|
+
const attachmentLinks = [];
|
|
57
|
+
const testResult = testResultRawToState({
|
|
58
|
+
testCases: __classPrivateFieldGet(this, _DefaultAllureStore_testCases, "f"),
|
|
59
|
+
attachments: __classPrivateFieldGet(this, _DefaultAllureStore_attachments, "f"),
|
|
60
|
+
visitAttachmentLink: (link) => attachmentLinks.push(link),
|
|
61
|
+
}, raw, context);
|
|
62
|
+
__classPrivateFieldGet(this, _DefaultAllureStore_testResults, "f").set(testResult.id, testResult);
|
|
63
|
+
if (testResult.historyId) {
|
|
64
|
+
const maybeOther = this.indexLatestTestResultByHistoryId.get(testResult.historyId);
|
|
65
|
+
if (maybeOther) {
|
|
66
|
+
if (maybeOther.start === undefined || testResult.start === undefined || maybeOther.start < testResult.start) {
|
|
67
|
+
this.indexLatestTestResultByHistoryId.set(testResult.historyId, testResult);
|
|
68
|
+
maybeOther.hidden = true;
|
|
69
|
+
}
|
|
70
|
+
else {
|
|
71
|
+
testResult.hidden = true;
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
else {
|
|
75
|
+
this.indexLatestTestResultByHistoryId.set(testResult.historyId, testResult);
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
index(this.indexTestResultByTestCase, testResult.testCase?.id, testResult);
|
|
79
|
+
index(this.indexTestResultByHistoryId, testResult.historyId, testResult);
|
|
80
|
+
index(this.indexAttachmentByTestResult, testResult.id, ...attachmentLinks);
|
|
81
|
+
__classPrivateFieldGet(this, _DefaultAllureStore_eventEmitter, "f")?.emit("testResult", testResult.id);
|
|
82
|
+
}
|
|
83
|
+
async visitTestFixtureResult(result, context) {
|
|
84
|
+
const attachmentLinks = [];
|
|
85
|
+
const testFixtureResult = testFixtureResultRawToState({
|
|
86
|
+
attachments: __classPrivateFieldGet(this, _DefaultAllureStore_attachments, "f"),
|
|
87
|
+
visitAttachmentLink: (link) => attachmentLinks.push(link),
|
|
88
|
+
}, result, context);
|
|
89
|
+
__classPrivateFieldGet(this, _DefaultAllureStore_fixtures, "f").set(testFixtureResult.id, testFixtureResult);
|
|
90
|
+
testFixtureResult.testResultIds.forEach((trId) => {
|
|
91
|
+
index(this.indexFixturesByTestResult, trId, testFixtureResult);
|
|
92
|
+
});
|
|
93
|
+
index(this.indexAttachmentByFixture, testFixtureResult.id, ...attachmentLinks);
|
|
94
|
+
__classPrivateFieldGet(this, _DefaultAllureStore_eventEmitter, "f")?.emit("testFixtureResult", testFixtureResult.id);
|
|
95
|
+
}
|
|
96
|
+
async visitAttachmentFile(resultFile, context) {
|
|
97
|
+
const originalFileName = resultFile.getOriginalFileName();
|
|
98
|
+
const id = md5(originalFileName);
|
|
99
|
+
__classPrivateFieldGet(this, _DefaultAllureStore_attachmentContents, "f").set(id, resultFile);
|
|
100
|
+
const maybeLink = __classPrivateFieldGet(this, _DefaultAllureStore_attachments, "f").get(id);
|
|
101
|
+
if (maybeLink) {
|
|
102
|
+
const link = maybeLink;
|
|
103
|
+
link.missed = false;
|
|
104
|
+
link.ext = link?.ext ?? extname(originalFileName);
|
|
105
|
+
link.contentType = link.contentType ?? resultFile.getContentType();
|
|
106
|
+
link.contentLength = resultFile.getContentLength();
|
|
107
|
+
}
|
|
108
|
+
else {
|
|
109
|
+
__classPrivateFieldGet(this, _DefaultAllureStore_attachments, "f").set(id, {
|
|
110
|
+
used: false,
|
|
111
|
+
missed: false,
|
|
112
|
+
id,
|
|
113
|
+
originalFileName,
|
|
114
|
+
ext: extname(originalFileName),
|
|
115
|
+
contentType: resultFile.getContentType(),
|
|
116
|
+
contentLength: resultFile.getContentLength(),
|
|
117
|
+
});
|
|
118
|
+
}
|
|
119
|
+
__classPrivateFieldGet(this, _DefaultAllureStore_eventEmitter, "f")?.emit("attachmentFile", id);
|
|
120
|
+
}
|
|
121
|
+
async visitMetadata(metadata, context) {
|
|
122
|
+
Object.keys(metadata).forEach((key) => __classPrivateFieldGet(this, _DefaultAllureStore_metadata, "f").set(key, metadata[key]));
|
|
123
|
+
}
|
|
124
|
+
async allTestCases() {
|
|
125
|
+
return Array.from(__classPrivateFieldGet(this, _DefaultAllureStore_testCases, "f").values());
|
|
126
|
+
}
|
|
127
|
+
async allTestResults(options = { includeHidden: false }) {
|
|
128
|
+
const { includeHidden } = options;
|
|
129
|
+
const result = Array.from(__classPrivateFieldGet(this, _DefaultAllureStore_testResults, "f").values());
|
|
130
|
+
return includeHidden ? result : result.filter((tr) => !tr.hidden);
|
|
131
|
+
}
|
|
132
|
+
async allAttachments(options = {}) {
|
|
133
|
+
const { includeMissed = false, includeUnused = false } = options;
|
|
134
|
+
const attachments = Array.from(__classPrivateFieldGet(this, _DefaultAllureStore_attachments, "f").values());
|
|
135
|
+
return attachments
|
|
136
|
+
.filter((link) => (!includeMissed ? !link.missed : true))
|
|
137
|
+
.filter((link) => (!includeUnused ? link.used : true));
|
|
138
|
+
}
|
|
139
|
+
async allMetadata() {
|
|
140
|
+
const result = {};
|
|
141
|
+
__classPrivateFieldGet(this, _DefaultAllureStore_metadata, "f").forEach((value, key) => (result[key] = value));
|
|
142
|
+
return result;
|
|
143
|
+
}
|
|
144
|
+
async allFixtures() {
|
|
145
|
+
return Array.from(__classPrivateFieldGet(this, _DefaultAllureStore_fixtures, "f").values());
|
|
146
|
+
}
|
|
147
|
+
async allHistoryDataPoints() {
|
|
148
|
+
console.log(__classPrivateFieldGet(this, _DefaultAllureStore_history, "f"));
|
|
149
|
+
return __classPrivateFieldGet(this, _DefaultAllureStore_history, "f");
|
|
150
|
+
}
|
|
151
|
+
async allKnownIssues() {
|
|
152
|
+
return __classPrivateFieldGet(this, _DefaultAllureStore_known, "f");
|
|
153
|
+
}
|
|
154
|
+
async testCaseById(tcId) {
|
|
155
|
+
return __classPrivateFieldGet(this, _DefaultAllureStore_testCases, "f").get(tcId);
|
|
156
|
+
}
|
|
157
|
+
async testResultById(trId) {
|
|
158
|
+
return __classPrivateFieldGet(this, _DefaultAllureStore_testResults, "f").get(trId);
|
|
159
|
+
}
|
|
160
|
+
async attachmentById(attachmentId) {
|
|
161
|
+
return __classPrivateFieldGet(this, _DefaultAllureStore_attachments, "f").get(attachmentId);
|
|
162
|
+
}
|
|
163
|
+
async attachmentContentById(attachmentId) {
|
|
164
|
+
return __classPrivateFieldGet(this, _DefaultAllureStore_attachmentContents, "f").get(attachmentId);
|
|
165
|
+
}
|
|
166
|
+
async metadataByKey(key) {
|
|
167
|
+
return __classPrivateFieldGet(this, _DefaultAllureStore_metadata, "f").get(key);
|
|
168
|
+
}
|
|
169
|
+
async testResultsByTcId(tcId) {
|
|
170
|
+
return this.indexTestResultByTestCase.get(tcId) ?? [];
|
|
171
|
+
}
|
|
172
|
+
async attachmentsByTrId(trId) {
|
|
173
|
+
return this.indexAttachmentByTestResult.get(trId) ?? [];
|
|
174
|
+
}
|
|
175
|
+
async retriesByTrId(trId) {
|
|
176
|
+
const tr = await this.testResultById(trId);
|
|
177
|
+
if (!tr || tr.hidden || !tr.historyId) {
|
|
178
|
+
return [];
|
|
179
|
+
}
|
|
180
|
+
return (this.indexTestResultByHistoryId.get(tr.historyId) ?? [])
|
|
181
|
+
.filter((tr) => tr.hidden)
|
|
182
|
+
.sort(nullsLast(compareBy("start", reverse(ordinal()))));
|
|
183
|
+
}
|
|
184
|
+
async historyByTrId(trId) {
|
|
185
|
+
console.log(__classPrivateFieldGet(this, _DefaultAllureStore_history, "f"));
|
|
186
|
+
const tr = await this.testResultById(trId);
|
|
187
|
+
if (!tr?.historyId) {
|
|
188
|
+
return [];
|
|
189
|
+
}
|
|
190
|
+
return [...__classPrivateFieldGet(this, _DefaultAllureStore_history, "f")]
|
|
191
|
+
.filter((dp) => !!dp.testResults[tr.historyId])
|
|
192
|
+
.map((dp) => ({ ...dp.testResults[tr.historyId] }));
|
|
193
|
+
}
|
|
194
|
+
async fixturesByTrId(trId) {
|
|
195
|
+
return this.indexFixturesByTestResult.get(trId) ?? [];
|
|
196
|
+
}
|
|
197
|
+
async failedTestResults() {
|
|
198
|
+
const allTestResults = await this.allTestResults();
|
|
199
|
+
return allTestResults.filter(({ status }) => status === "failed" || status === "broken");
|
|
200
|
+
}
|
|
201
|
+
async unknownFailedTestResults() {
|
|
202
|
+
const failedTestResults = await this.failedTestResults();
|
|
203
|
+
if (!__classPrivateFieldGet(this, _DefaultAllureStore_known, "f")?.length) {
|
|
204
|
+
return failedTestResults;
|
|
205
|
+
}
|
|
206
|
+
const knownHistoryIds = __classPrivateFieldGet(this, _DefaultAllureStore_known, "f").map((ktf) => ktf.historyId);
|
|
207
|
+
return failedTestResults.filter(({ historyId }) => historyId && !knownHistoryIds.includes(historyId));
|
|
208
|
+
}
|
|
209
|
+
async testResultsByLabel(labelName) {
|
|
210
|
+
const results = {
|
|
211
|
+
_: [],
|
|
212
|
+
};
|
|
213
|
+
const all = await this.allTestResults();
|
|
214
|
+
all.forEach((test) => {
|
|
215
|
+
const targetLabels = (test.labels ?? []).filter((label) => label.name === labelName);
|
|
216
|
+
if (targetLabels.length === 0) {
|
|
217
|
+
results._.push(test);
|
|
218
|
+
return;
|
|
219
|
+
}
|
|
220
|
+
targetLabels.forEach((label) => {
|
|
221
|
+
if (!results[label.value]) {
|
|
222
|
+
results[label.value] = [];
|
|
223
|
+
}
|
|
224
|
+
results[label.value].push(test);
|
|
225
|
+
});
|
|
226
|
+
});
|
|
227
|
+
return results;
|
|
228
|
+
}
|
|
229
|
+
async testsStatistic() {
|
|
230
|
+
const all = await this.allTestResults();
|
|
231
|
+
return all.reduce((acc, test) => {
|
|
232
|
+
if (!acc[test.status]) {
|
|
233
|
+
acc[test.status] = 0;
|
|
234
|
+
}
|
|
235
|
+
acc[test.status]++;
|
|
236
|
+
return acc;
|
|
237
|
+
}, { total: all.length });
|
|
238
|
+
}
|
|
239
|
+
}
|
|
240
|
+
_DefaultAllureStore_testResults = 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_eventEmitter = new WeakMap();
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const shortHash: () => string;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { BatchOptions, Realtime } from "@allurereport/plugin-api";
|
|
2
|
+
import type { EventEmitter } from "node:events";
|
|
3
|
+
export interface AllureStoreEvents {
|
|
4
|
+
testResult: [string];
|
|
5
|
+
testFixtureResult: [string];
|
|
6
|
+
attachmentFile: [string];
|
|
7
|
+
}
|
|
8
|
+
export declare class Events implements Realtime {
|
|
9
|
+
#private;
|
|
10
|
+
constructor(emitter: EventEmitter<AllureStoreEvents>);
|
|
11
|
+
onTestResults: (listener: (trIds: string[]) => Promise<void>, options?: BatchOptions) => void;
|
|
12
|
+
onTestFixtureResults: (listener: (tfrIds: string[]) => Promise<void>, options?: BatchOptions) => void;
|
|
13
|
+
onAttachmentFiles(listener: (afIds: string[]) => Promise<void>, options?: BatchOptions): void;
|
|
14
|
+
onAll(listener: () => Promise<void>, options?: BatchOptions): void;
|
|
15
|
+
offAll(): void;
|
|
16
|
+
}
|
|
@@ -0,0 +1,78 @@
|
|
|
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 _Events_instances, _Events_emitter, _Events_handlers, _Events_createHandler;
|
|
13
|
+
import console from "node:console";
|
|
14
|
+
import { setTimeout } from "node:timers/promises";
|
|
15
|
+
export class Events {
|
|
16
|
+
constructor(emitter) {
|
|
17
|
+
_Events_instances.add(this);
|
|
18
|
+
_Events_emitter.set(this, void 0);
|
|
19
|
+
_Events_handlers.set(this, []);
|
|
20
|
+
this.onTestResults = (listener, options = {}) => {
|
|
21
|
+
const { maxTimeout = 100 } = options;
|
|
22
|
+
const handler = __classPrivateFieldGet(this, _Events_instances, "m", _Events_createHandler).call(this, maxTimeout, listener);
|
|
23
|
+
__classPrivateFieldGet(this, _Events_emitter, "f").on("testResult", handler);
|
|
24
|
+
};
|
|
25
|
+
this.onTestFixtureResults = (listener, options = {}) => {
|
|
26
|
+
const { maxTimeout = 100 } = options;
|
|
27
|
+
const handler = __classPrivateFieldGet(this, _Events_instances, "m", _Events_createHandler).call(this, maxTimeout, listener);
|
|
28
|
+
__classPrivateFieldGet(this, _Events_emitter, "f").on("testFixtureResult", handler);
|
|
29
|
+
};
|
|
30
|
+
__classPrivateFieldSet(this, _Events_emitter, emitter, "f");
|
|
31
|
+
}
|
|
32
|
+
onAttachmentFiles(listener, options = {}) {
|
|
33
|
+
const { maxTimeout = 100 } = options;
|
|
34
|
+
const handler = __classPrivateFieldGet(this, _Events_instances, "m", _Events_createHandler).call(this, maxTimeout, listener);
|
|
35
|
+
__classPrivateFieldGet(this, _Events_emitter, "f").on("attachmentFile", handler);
|
|
36
|
+
}
|
|
37
|
+
onAll(listener, options = {}) {
|
|
38
|
+
const { maxTimeout = 100 } = options;
|
|
39
|
+
const handler = __classPrivateFieldGet(this, _Events_instances, "m", _Events_createHandler).call(this, maxTimeout, listener);
|
|
40
|
+
__classPrivateFieldGet(this, _Events_emitter, "f").on("testResult", handler);
|
|
41
|
+
__classPrivateFieldGet(this, _Events_emitter, "f").on("testFixtureResult", handler);
|
|
42
|
+
__classPrivateFieldGet(this, _Events_emitter, "f").on("attachmentFile", handler);
|
|
43
|
+
}
|
|
44
|
+
offAll() {
|
|
45
|
+
__classPrivateFieldGet(this, _Events_emitter, "f").removeAllListeners();
|
|
46
|
+
for (const handler of __classPrivateFieldGet(this, _Events_handlers, "f")) {
|
|
47
|
+
handler.ac?.abort();
|
|
48
|
+
}
|
|
49
|
+
__classPrivateFieldSet(this, _Events_handlers, [], "f");
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
_Events_emitter = new WeakMap(), _Events_handlers = new WeakMap(), _Events_instances = new WeakSet(), _Events_createHandler = function _Events_createHandler(maxTimeout, listener) {
|
|
53
|
+
const handler = {
|
|
54
|
+
buffer: [],
|
|
55
|
+
};
|
|
56
|
+
__classPrivateFieldGet(this, _Events_handlers, "f").push(handler);
|
|
57
|
+
return (trId) => {
|
|
58
|
+
handler.buffer.push(trId);
|
|
59
|
+
if (handler.timeout) {
|
|
60
|
+
return;
|
|
61
|
+
}
|
|
62
|
+
handler.ac = new AbortController();
|
|
63
|
+
handler.timeout = setTimeout(maxTimeout, undefined, { signal: handler.ac.signal })
|
|
64
|
+
.then(() => {
|
|
65
|
+
handler.timeout = undefined;
|
|
66
|
+
const bufferCopy = [...handler.buffer];
|
|
67
|
+
handler.buffer = [];
|
|
68
|
+
handler.ac = undefined;
|
|
69
|
+
return listener(bufferCopy);
|
|
70
|
+
})
|
|
71
|
+
.catch((err) => {
|
|
72
|
+
if (err.name === "AbortError") {
|
|
73
|
+
return;
|
|
74
|
+
}
|
|
75
|
+
console.error("can't execute listener", err);
|
|
76
|
+
});
|
|
77
|
+
};
|
|
78
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const isFileNotFoundError: (e: unknown) => e is Error;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export const isFileNotFoundError = (e) => e instanceof Error && "code" in e && e.code === "ENOENT";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const importWrapper: (path: string) => Promise<any>;
|
package/package.json
ADDED
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@allurereport/core",
|
|
3
|
+
"version": "3.0.0-beta.3",
|
|
4
|
+
"description": "Collection of generic Allure utilities used across the entire project",
|
|
5
|
+
"keywords": [
|
|
6
|
+
"allure"
|
|
7
|
+
],
|
|
8
|
+
"repository": "https://github.com/allure-framework/allure3",
|
|
9
|
+
"license": "Apache-2.0",
|
|
10
|
+
"author": "Qameta Software",
|
|
11
|
+
"type": "module",
|
|
12
|
+
"exports": {
|
|
13
|
+
".": "./dist/index.js"
|
|
14
|
+
},
|
|
15
|
+
"module": "dist/index.js",
|
|
16
|
+
"types": "dist/index.d.ts",
|
|
17
|
+
"files": [
|
|
18
|
+
"dist"
|
|
19
|
+
],
|
|
20
|
+
"scripts": {
|
|
21
|
+
"build": "run clean && tsc --project ./tsconfig.json",
|
|
22
|
+
"clean": "rimraf ./dist",
|
|
23
|
+
"test": "vitest run"
|
|
24
|
+
},
|
|
25
|
+
"dependencies": {
|
|
26
|
+
"@allurereport/core-api": "3.0.0-beta.3",
|
|
27
|
+
"@allurereport/plugin-api": "3.0.0-beta.3",
|
|
28
|
+
"@allurereport/plugin-awesome": "3.0.0-beta.3",
|
|
29
|
+
"@allurereport/plugin-classic": "3.0.0-beta.3",
|
|
30
|
+
"@allurereport/plugin-csv": "3.0.0-beta.3",
|
|
31
|
+
"@allurereport/plugin-log": "3.0.0-beta.3",
|
|
32
|
+
"@allurereport/plugin-progress": "3.0.0-beta.3",
|
|
33
|
+
"@allurereport/plugin-slack": "3.0.0-beta.3",
|
|
34
|
+
"@allurereport/plugin-testplan": "3.0.0-beta.3",
|
|
35
|
+
"@allurereport/reader": "3.0.0-beta.3",
|
|
36
|
+
"@allurereport/reader-api": "3.0.0-beta.3",
|
|
37
|
+
"markdown-it": "^14.1.0"
|
|
38
|
+
},
|
|
39
|
+
"devDependencies": {
|
|
40
|
+
"@stylistic/eslint-plugin": "^2.6.1",
|
|
41
|
+
"@types/eslint": "^8.56.11",
|
|
42
|
+
"@types/markdown-it": "^14.1.2",
|
|
43
|
+
"@types/node": "^20.17.9",
|
|
44
|
+
"@typescript-eslint/eslint-plugin": "^8.0.0",
|
|
45
|
+
"@typescript-eslint/parser": "^8.0.0",
|
|
46
|
+
"@vitest/runner": "^2.1.8",
|
|
47
|
+
"@vitest/snapshot": "^2.1.8",
|
|
48
|
+
"allure-js-commons": "^3.0.7",
|
|
49
|
+
"allure-vitest": "^3.0.7",
|
|
50
|
+
"eslint": "^8.57.0",
|
|
51
|
+
"eslint-config-prettier": "^9.1.0",
|
|
52
|
+
"eslint-plugin-import": "^2.29.1",
|
|
53
|
+
"eslint-plugin-jsdoc": "^50.0.0",
|
|
54
|
+
"eslint-plugin-n": "^17.10.1",
|
|
55
|
+
"eslint-plugin-no-null": "^1.0.2",
|
|
56
|
+
"eslint-plugin-prefer-arrow": "^1.2.3",
|
|
57
|
+
"rimraf": "^6.0.1",
|
|
58
|
+
"tslib": "^2.7.0",
|
|
59
|
+
"typescript": "^5.6.3",
|
|
60
|
+
"vitest": "^2.1.8"
|
|
61
|
+
}
|
|
62
|
+
}
|