@allurereport/plugin-jira 3.18.0 → 3.19.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/helpers.d.ts +1 -1
- package/dist/helpers.js +9 -4
- package/dist/plugin.js +6 -5
- package/package.json +3 -3
package/dist/helpers.d.ts
CHANGED
|
@@ -2,7 +2,7 @@ import { type TestResult } from "@allurereport/core-api";
|
|
|
2
2
|
import { type ForgePluginTestResult } from "./types.js";
|
|
3
3
|
export declare const isJiraIssueKey: (issue: string) => boolean;
|
|
4
4
|
export declare const findJiraLink: (tr: TestResult) => import("@allurereport/core-api").TestLink | undefined;
|
|
5
|
-
export declare const prepareTestResults: (trs: TestResult[]) => ForgePluginTestResult[];
|
|
5
|
+
export declare const prepareTestResults: (trs: TestResult[], environmentNames?: ReadonlyMap<string, string>) => ForgePluginTestResult[];
|
|
6
6
|
export declare const trimName: (name: string) => string;
|
|
7
7
|
export declare const trimParameters: (p: string) => string;
|
|
8
8
|
export declare const trimCiInfoLabel: (label: string) => string;
|
package/dist/helpers.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { DEFAULT_ENVIRONMENT } from "@allurereport/core-api";
|
|
1
|
+
import { DEFAULT_ENVIRONMENT, calculateRetryHash } from "@allurereport/core-api";
|
|
2
2
|
const isJiraUrl = (url) => {
|
|
3
3
|
const jiraPattern = /^https:\/\/[a-zA-Z0-9-]+\.atlassian\.net\/browse\/[A-Z]+-\d+$/;
|
|
4
4
|
return jiraPattern.test(url);
|
|
@@ -41,14 +41,14 @@ const filterOutDefaultEnvironment = (env) => {
|
|
|
41
41
|
}
|
|
42
42
|
return env;
|
|
43
43
|
};
|
|
44
|
-
export const prepareTestResults = (trs) => {
|
|
44
|
+
export const prepareTestResults = (trs, environmentNames = new Map()) => {
|
|
45
45
|
const trMap = new Map();
|
|
46
46
|
for (const tr of trs) {
|
|
47
47
|
const jiraLink = findJiraLink(tr);
|
|
48
48
|
if (!jiraLink) {
|
|
49
49
|
continue;
|
|
50
50
|
}
|
|
51
|
-
const trId = tr.
|
|
51
|
+
const trId = calculateRetryHash({ testCaseHash: tr.testCaseHash, parametersHash: tr.parametersHash }) ?? tr.id;
|
|
52
52
|
if (!trMap.has(trId)) {
|
|
53
53
|
trMap.set(trId, {
|
|
54
54
|
id: trId,
|
|
@@ -59,7 +59,12 @@ export const prepareTestResults = (trs) => {
|
|
|
59
59
|
});
|
|
60
60
|
}
|
|
61
61
|
const storedTr = trMap.get(trId);
|
|
62
|
-
|
|
62
|
+
const environmentId = filterOutDefaultEnvironment(tr.environment);
|
|
63
|
+
storedTr.entries.push({
|
|
64
|
+
status: tr.status,
|
|
65
|
+
env: environmentId ? (environmentNames.get(environmentId) ?? environmentId) : undefined,
|
|
66
|
+
date: tr.stop,
|
|
67
|
+
});
|
|
63
68
|
storedTr.keyParams.push(...tr.parameters);
|
|
64
69
|
}
|
|
65
70
|
return Array.from(trMap.values()).map((tr) => {
|
package/dist/plugin.js
CHANGED
|
@@ -85,7 +85,8 @@ _JiraPlugin_pluginName = new WeakMap(), _JiraPlugin_instances = new WeakSet(), _
|
|
|
85
85
|
if (allTestResults.length === 0) {
|
|
86
86
|
throw new Error(`[${__classPrivateFieldGet(this, _JiraPlugin_pluginName, "f")}] no test results found`);
|
|
87
87
|
}
|
|
88
|
-
const
|
|
88
|
+
const environments = await store.allEnvironmentIdentities();
|
|
89
|
+
const testResults = prepareTestResults(allTestResults, new Map(environments.map(({ id, name }) => [id, name])));
|
|
89
90
|
const payload = {
|
|
90
91
|
results: testResults,
|
|
91
92
|
reportUrl: context.reportUrl,
|
|
@@ -114,12 +115,12 @@ _JiraPlugin_pluginName = new WeakMap(), _JiraPlugin_instances = new WeakSet(), _
|
|
|
114
115
|
return "failed";
|
|
115
116
|
}, _JiraPlugin_getStatisticByEnv = async function _JiraPlugin_getStatisticByEnv(store) {
|
|
116
117
|
const statisticByEnv = {};
|
|
117
|
-
const envs = await store.
|
|
118
|
-
for (const
|
|
119
|
-
if (
|
|
118
|
+
const envs = await store.allEnvironmentIdentities();
|
|
119
|
+
for (const { id, name } of envs) {
|
|
120
|
+
if (id === DEFAULT_ENVIRONMENT) {
|
|
120
121
|
continue;
|
|
121
122
|
}
|
|
122
|
-
statisticByEnv[
|
|
123
|
+
statisticByEnv[name] = await store.testsStatistic((tr) => tr.environment === id);
|
|
123
124
|
}
|
|
124
125
|
return statisticByEnv;
|
|
125
126
|
}, _JiraPlugin_getCiInfo = async function _JiraPlugin_getCiInfo(context) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@allurereport/plugin-jira",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.19.0",
|
|
4
4
|
"description": "Allure Plugin to Report results to Jira",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"allure",
|
|
@@ -30,8 +30,8 @@
|
|
|
30
30
|
"lint:fix": "oxlint --import-plugin --fix src test features stories"
|
|
31
31
|
},
|
|
32
32
|
"dependencies": {
|
|
33
|
-
"@allurereport/core-api": "3.
|
|
34
|
-
"@allurereport/plugin-api": "3.
|
|
33
|
+
"@allurereport/core-api": "3.19.0",
|
|
34
|
+
"@allurereport/plugin-api": "3.19.0",
|
|
35
35
|
"axios": "^1.20.0"
|
|
36
36
|
},
|
|
37
37
|
"devDependencies": {
|