@allurereport/core 3.0.0-beta.22 → 3.0.0-beta.23
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/qualityGate/qualityGate.js +13 -6
- package/dist/qualityGate/rules.js +6 -7
- package/dist/report.js +8 -6
- package/package.json +18 -18
|
@@ -58,7 +58,7 @@ export class QualityGate {
|
|
|
58
58
|
if (fastFailed) {
|
|
59
59
|
break;
|
|
60
60
|
}
|
|
61
|
-
for (const [key,
|
|
61
|
+
for (const [key, expected] of Object.entries(ruleset)) {
|
|
62
62
|
if (key === "filter" || key === "id" || key === "fastFail") {
|
|
63
63
|
continue;
|
|
64
64
|
}
|
|
@@ -66,21 +66,28 @@ export class QualityGate {
|
|
|
66
66
|
if (!rule) {
|
|
67
67
|
throw new Error(`Rule ${key} is not provided. Make sure you have provided it in the "use" field of the quality gate config!`);
|
|
68
68
|
}
|
|
69
|
+
const trsToValidate = ruleset.filter ? trs.filter(ruleset.filter) : trs;
|
|
69
70
|
const ruleId = ruleset.id ? [ruleset.id, rule.rule].join("/") : rule.rule;
|
|
70
71
|
const result = await rule.validate({
|
|
71
|
-
|
|
72
|
-
|
|
72
|
+
trs: trsToValidate,
|
|
73
|
+
state: {
|
|
74
|
+
getResult: () => state?.getResult?.(ruleId),
|
|
75
|
+
setResult: (value) => state?.setResult?.(ruleId, value),
|
|
76
|
+
},
|
|
77
|
+
expected,
|
|
73
78
|
knownIssues,
|
|
74
|
-
state: state?.getResult?.(ruleId),
|
|
75
79
|
});
|
|
76
|
-
state?.setResult(ruleId, result.actual);
|
|
77
80
|
if (result.success) {
|
|
78
81
|
continue;
|
|
79
82
|
}
|
|
80
83
|
results.push({
|
|
81
84
|
...result,
|
|
85
|
+
expected,
|
|
82
86
|
rule: ruleset.id ? [ruleset.id, rule.rule].join("/") : rule.rule,
|
|
83
|
-
message: rule.message(
|
|
87
|
+
message: rule.message({
|
|
88
|
+
actual: result.actual,
|
|
89
|
+
expected,
|
|
90
|
+
}),
|
|
84
91
|
});
|
|
85
92
|
if (ruleset.fastFail) {
|
|
86
93
|
fastFailed = true;
|
|
@@ -3,27 +3,27 @@ import { bold } from "yoctocolors";
|
|
|
3
3
|
export const maxFailuresRule = {
|
|
4
4
|
rule: "maxFailures",
|
|
5
5
|
message: ({ actual, expected }) => `The number of failed tests ${bold(String(actual))} exceeds the allowed threshold value ${bold(String(expected))}`,
|
|
6
|
-
validate: async ({ trs, knownIssues, expected, state
|
|
6
|
+
validate: async ({ trs, knownIssues, expected, state }) => {
|
|
7
7
|
const knownIssuesHistoryIds = knownIssues.map(({ historyId }) => historyId);
|
|
8
8
|
const unknown = trs.filter((tr) => !tr.historyId || !knownIssuesHistoryIds.includes(tr.historyId));
|
|
9
9
|
const failedTrs = unknown.filter(filterUnsuccessful);
|
|
10
|
-
const actual = failedTrs.length + state;
|
|
10
|
+
const actual = failedTrs.length + (state.getResult() ?? 0);
|
|
11
|
+
state.setResult(actual);
|
|
11
12
|
return {
|
|
12
13
|
success: actual <= expected,
|
|
13
14
|
actual,
|
|
14
|
-
expected,
|
|
15
15
|
};
|
|
16
16
|
},
|
|
17
17
|
};
|
|
18
18
|
export const minTestsCountRule = {
|
|
19
19
|
rule: "minTestsCount",
|
|
20
20
|
message: ({ actual, expected }) => `The total number of tests ${bold(String(actual))} is less than the expected threshold value ${bold(String(expected))}`,
|
|
21
|
-
validate: async ({ trs, expected, state
|
|
22
|
-
const actual = trs.length + state;
|
|
21
|
+
validate: async ({ trs, expected, state }) => {
|
|
22
|
+
const actual = trs.length + (state.getResult() ?? 0);
|
|
23
|
+
state.setResult(actual);
|
|
23
24
|
return {
|
|
24
25
|
success: actual >= expected,
|
|
25
26
|
actual,
|
|
26
|
-
expected,
|
|
27
27
|
};
|
|
28
28
|
},
|
|
29
29
|
};
|
|
@@ -38,7 +38,6 @@ export const successRateRule = {
|
|
|
38
38
|
return {
|
|
39
39
|
success: rate >= expected,
|
|
40
40
|
actual: rate,
|
|
41
|
-
expected,
|
|
42
41
|
};
|
|
43
42
|
},
|
|
44
43
|
};
|
package/dist/report.js
CHANGED
|
@@ -331,10 +331,12 @@ export class AllureReport {
|
|
|
331
331
|
if (__classPrivateFieldGet(this, _AllureReport_allureServiceClient, "f") && context.publish) {
|
|
332
332
|
const pluginFiles = (await context.state.get("files")) ?? {};
|
|
333
333
|
const pluginFilesEntries = Object.entries(pluginFiles);
|
|
334
|
-
const progressBar =
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
334
|
+
const progressBar = pluginFilesEntries?.length > 0
|
|
335
|
+
? new ProgressBar(`Publishing "${context.id}" report [:bar] :current/:total`, {
|
|
336
|
+
total: pluginFilesEntries.length,
|
|
337
|
+
width: 20,
|
|
338
|
+
})
|
|
339
|
+
: undefined;
|
|
338
340
|
const limitFn = pLimit(50);
|
|
339
341
|
const fns = pluginFilesEntries.map(([filename, filepath]) => limitFn(async () => {
|
|
340
342
|
if (/^(data|widgets|index\.html$|summary\.json$)/.test(filename)) {
|
|
@@ -351,9 +353,9 @@ export class AllureReport {
|
|
|
351
353
|
filepath,
|
|
352
354
|
});
|
|
353
355
|
}
|
|
354
|
-
progressBar
|
|
356
|
+
progressBar?.tick?.();
|
|
355
357
|
}));
|
|
356
|
-
progressBar
|
|
358
|
+
progressBar?.render?.();
|
|
357
359
|
await Promise.all(fns);
|
|
358
360
|
}
|
|
359
361
|
const summary = await plugin?.info?.(context, __classPrivateFieldGet(this, _AllureReport_store, "f"));
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@allurereport/core",
|
|
3
|
-
"version": "3.0.0-beta.
|
|
3
|
+
"version": "3.0.0-beta.23",
|
|
4
4
|
"description": "Collection of generic Allure utilities used across the entire project",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"allure"
|
|
@@ -25,23 +25,23 @@
|
|
|
25
25
|
"test": "vitest run"
|
|
26
26
|
},
|
|
27
27
|
"dependencies": {
|
|
28
|
-
"@allurereport/ci": "3.0.0-beta.
|
|
29
|
-
"@allurereport/core-api": "3.0.0-beta.
|
|
30
|
-
"@allurereport/plugin-allure2": "3.0.0-beta.
|
|
31
|
-
"@allurereport/plugin-api": "3.0.0-beta.
|
|
32
|
-
"@allurereport/plugin-awesome": "3.0.0-beta.
|
|
33
|
-
"@allurereport/plugin-classic": "3.0.0-beta.
|
|
34
|
-
"@allurereport/plugin-csv": "3.0.0-beta.
|
|
35
|
-
"@allurereport/plugin-dashboard": "3.0.0-beta.
|
|
36
|
-
"@allurereport/plugin-jira": "3.0.0-beta.
|
|
37
|
-
"@allurereport/plugin-log": "3.0.0-beta.
|
|
38
|
-
"@allurereport/plugin-progress": "3.0.0-beta.
|
|
39
|
-
"@allurereport/plugin-slack": "3.0.0-beta.
|
|
40
|
-
"@allurereport/plugin-testplan": "3.0.0-beta.
|
|
41
|
-
"@allurereport/reader": "3.0.0-beta.
|
|
42
|
-
"@allurereport/reader-api": "3.0.0-beta.
|
|
43
|
-
"@allurereport/service": "3.0.0-beta.
|
|
44
|
-
"@allurereport/summary": "3.0.0-beta.
|
|
28
|
+
"@allurereport/ci": "3.0.0-beta.23",
|
|
29
|
+
"@allurereport/core-api": "3.0.0-beta.23",
|
|
30
|
+
"@allurereport/plugin-allure2": "3.0.0-beta.23",
|
|
31
|
+
"@allurereport/plugin-api": "3.0.0-beta.23",
|
|
32
|
+
"@allurereport/plugin-awesome": "3.0.0-beta.23",
|
|
33
|
+
"@allurereport/plugin-classic": "3.0.0-beta.23",
|
|
34
|
+
"@allurereport/plugin-csv": "3.0.0-beta.23",
|
|
35
|
+
"@allurereport/plugin-dashboard": "3.0.0-beta.23",
|
|
36
|
+
"@allurereport/plugin-jira": "3.0.0-beta.23",
|
|
37
|
+
"@allurereport/plugin-log": "3.0.0-beta.23",
|
|
38
|
+
"@allurereport/plugin-progress": "3.0.0-beta.23",
|
|
39
|
+
"@allurereport/plugin-slack": "3.0.0-beta.23",
|
|
40
|
+
"@allurereport/plugin-testplan": "3.0.0-beta.23",
|
|
41
|
+
"@allurereport/reader": "3.0.0-beta.23",
|
|
42
|
+
"@allurereport/reader-api": "3.0.0-beta.23",
|
|
43
|
+
"@allurereport/service": "3.0.0-beta.23",
|
|
44
|
+
"@allurereport/summary": "3.0.0-beta.23",
|
|
45
45
|
"handlebars": "^4.7.8",
|
|
46
46
|
"markdown-it": "^14.1.0",
|
|
47
47
|
"node-stream-zip": "^1.15.0",
|