@allurereport/plugin-api 3.0.0-beta.23 → 3.0.0-beta.25
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/plugin.d.ts +1 -0
- package/dist/store.d.ts +1 -0
- package/dist/utils/tree.d.ts +1 -0
- package/dist/utils/tree.js +36 -0
- package/package.json +2 -2
package/dist/plugin.d.ts
CHANGED
package/dist/store.d.ts
CHANGED
|
@@ -12,6 +12,7 @@ export interface AllureStore {
|
|
|
12
12
|
allMetadata: () => Promise<Record<string, any>>;
|
|
13
13
|
allFixtures: () => Promise<TestFixtureResult[]>;
|
|
14
14
|
allHistoryDataPoints: () => Promise<HistoryDataPoint[]>;
|
|
15
|
+
allHistoryDataPointsByEnvironment: (environment: string) => Promise<HistoryDataPoint[]>;
|
|
15
16
|
allKnownIssues: () => Promise<KnownTestFailure[]>;
|
|
16
17
|
allNewTestResults: () => Promise<TestResult[]>;
|
|
17
18
|
qualityGateResults: () => Promise<QualityGateValidationResult[]>;
|
package/dist/utils/tree.d.ts
CHANGED
|
@@ -9,3 +9,4 @@ export declare const filterTree: <L, G>(tree: TreeData<L, G>, predicate: (leaf:
|
|
|
9
9
|
export declare const sortTree: <L, G>(tree: TreeData<L, G>, comparator: Comparator<TreeLeaf<L>>) => TreeData<L, G>;
|
|
10
10
|
export declare const transformTree: <L, G>(tree: TreeData<L, G>, transformer: (leaf: TreeLeaf<L>, idx: number) => TreeLeaf<L>) => TreeData<L, G>;
|
|
11
11
|
export declare const createTreeByTitlePath: <T = TestResult, L = DefaultTreeLeaf, G = DefaultTreeGroup>(data: T[], leafFactory?: (item: T) => TreeLeaf<L>, groupFactory?: (parentGroup: string | undefined, groupClassifier: string) => TreeGroup<G>, addLeafToGroup?: (group: TreeGroup<G>, leaf: TreeLeaf<L>) => void) => TreeData<L, G>;
|
|
12
|
+
export declare const createTreeByLabelsAndTitlePath: <T = TestResult, L = DefaultTreeLeaf, G = DefaultTreeGroup>(data: T[], labelNames?: string[], leafFactory?: (item: T) => TreeLeaf<L>, groupFactory?: (parentGroup: string | undefined, groupClassifier: string) => TreeGroup<G>, addLeafToGroup?: (group: TreeGroup<G>, leaf: TreeLeaf<L>) => void) => TreeData<L, G>;
|
package/dist/utils/tree.js
CHANGED
|
@@ -216,3 +216,39 @@ export const createTreeByTitlePath = (data, leafFactory, groupFactory, addLeafTo
|
|
|
216
216
|
}));
|
|
217
217
|
return createTree(data, (item) => (item.titlePath ?? []).map((segment) => [segment]), leafFactoryFn, groupFactoryFn, addLeafToGroup);
|
|
218
218
|
};
|
|
219
|
+
const byLabelsAndTitlePath = (item, labelNames) => {
|
|
220
|
+
const leaves = [];
|
|
221
|
+
for (const labelName of labelNames) {
|
|
222
|
+
const values = item.labels.filter((label) => label.name === labelName).map((label) => label.value ?? "");
|
|
223
|
+
if (!values.length) {
|
|
224
|
+
continue;
|
|
225
|
+
}
|
|
226
|
+
leaves.push(values);
|
|
227
|
+
}
|
|
228
|
+
const titlePath = item.titlePath;
|
|
229
|
+
if (Array.isArray(titlePath) && titlePath.length > 0) {
|
|
230
|
+
for (const segment of titlePath) {
|
|
231
|
+
leaves.push([segment]);
|
|
232
|
+
}
|
|
233
|
+
}
|
|
234
|
+
return leaves;
|
|
235
|
+
};
|
|
236
|
+
export const createTreeByLabelsAndTitlePath = (data, labelNames = [], leafFactory, groupFactory, addLeafToGroup = () => { }) => {
|
|
237
|
+
const leafFactoryFn = leafFactory ??
|
|
238
|
+
((tr) => {
|
|
239
|
+
const { id, name, status, duration } = tr;
|
|
240
|
+
return {
|
|
241
|
+
nodeId: id,
|
|
242
|
+
name,
|
|
243
|
+
status,
|
|
244
|
+
duration,
|
|
245
|
+
};
|
|
246
|
+
});
|
|
247
|
+
const groupFactoryFn = groupFactory ??
|
|
248
|
+
((parentId, groupClassifier) => ({
|
|
249
|
+
nodeId: md5((parentId ? `${parentId}.` : "") + groupClassifier),
|
|
250
|
+
name: groupClassifier,
|
|
251
|
+
statistic: emptyStatistic(),
|
|
252
|
+
}));
|
|
253
|
+
return createTree(data, (item) => byLabelsAndTitlePath(item, labelNames), leafFactoryFn, groupFactoryFn, addLeafToGroup);
|
|
254
|
+
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@allurereport/plugin-api",
|
|
3
|
-
"version": "3.0.0-beta.
|
|
3
|
+
"version": "3.0.0-beta.25",
|
|
4
4
|
"description": "Allure Plugin API",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"allure"
|
|
@@ -26,7 +26,7 @@
|
|
|
26
26
|
"test": "rimraf ./out && vitest run"
|
|
27
27
|
},
|
|
28
28
|
"dependencies": {
|
|
29
|
-
"@allurereport/core-api": "3.0.0-beta.
|
|
29
|
+
"@allurereport/core-api": "3.0.0-beta.25"
|
|
30
30
|
},
|
|
31
31
|
"devDependencies": {
|
|
32
32
|
"@stylistic/eslint-plugin": "^2.6.1",
|