@allurereport/core 3.0.0-beta.17 → 3.0.0-beta.19

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@allurereport/core",
3
- "version": "3.0.0-beta.17",
3
+ "version": "3.0.0-beta.19",
4
4
  "description": "Collection of generic Allure utilities used across the entire project",
5
5
  "keywords": [
6
6
  "allure"
@@ -25,24 +25,27 @@
25
25
  "test": "vitest run"
26
26
  },
27
27
  "dependencies": {
28
- "@allurereport/ci": "3.0.0-beta.17",
29
- "@allurereport/core-api": "3.0.0-beta.17",
30
- "@allurereport/plugin-allure2": "3.0.0-beta.17",
31
- "@allurereport/plugin-api": "3.0.0-beta.17",
32
- "@allurereport/plugin-awesome": "3.0.0-beta.17",
33
- "@allurereport/plugin-classic": "3.0.0-beta.17",
34
- "@allurereport/plugin-csv": "3.0.0-beta.17",
35
- "@allurereport/plugin-dashboard": "3.0.0-beta.17",
36
- "@allurereport/plugin-log": "3.0.0-beta.17",
37
- "@allurereport/plugin-progress": "3.0.0-beta.17",
38
- "@allurereport/plugin-slack": "3.0.0-beta.17",
39
- "@allurereport/plugin-testplan": "3.0.0-beta.17",
40
- "@allurereport/reader": "3.0.0-beta.17",
41
- "@allurereport/reader-api": "3.0.0-beta.17",
42
- "@allurereport/service": "3.0.0-beta.17",
43
- "@allurereport/summary": "3.0.0-beta.17",
28
+ "@allurereport/ci": "3.0.0-beta.19",
29
+ "@allurereport/core-api": "3.0.0-beta.19",
30
+ "@allurereport/plugin-allure2": "3.0.0-beta.19",
31
+ "@allurereport/plugin-api": "3.0.0-beta.19",
32
+ "@allurereport/plugin-awesome": "3.0.0-beta.19",
33
+ "@allurereport/plugin-classic": "3.0.0-beta.19",
34
+ "@allurereport/plugin-csv": "3.0.0-beta.19",
35
+ "@allurereport/plugin-dashboard": "3.0.0-beta.19",
36
+ "@allurereport/plugin-log": "3.0.0-beta.19",
37
+ "@allurereport/plugin-progress": "3.0.0-beta.19",
38
+ "@allurereport/plugin-slack": "3.0.0-beta.19",
39
+ "@allurereport/plugin-testplan": "3.0.0-beta.19",
40
+ "@allurereport/reader": "3.0.0-beta.19",
41
+ "@allurereport/reader-api": "3.0.0-beta.19",
42
+ "@allurereport/service": "3.0.0-beta.19",
43
+ "@allurereport/summary": "3.0.0-beta.19",
44
44
  "handlebars": "^4.7.8",
45
- "markdown-it": "^14.1.0"
45
+ "markdown-it": "^14.1.0",
46
+ "node-stream-zip": "^1.15.0",
47
+ "yoctocolors": "^2.1.1",
48
+ "zip-stream": "^7.0.2"
46
49
  },
47
50
  "devDependencies": {
48
51
  "@stylistic/eslint-plugin": "^2.6.1",
@@ -50,12 +53,13 @@
50
53
  "@types/handlebars": "^4.1.0",
51
54
  "@types/markdown-it": "^14.1.2",
52
55
  "@types/node": "^20.17.9",
56
+ "@types/zip-stream": "^7.0.0",
53
57
  "@typescript-eslint/eslint-plugin": "^8.0.0",
54
58
  "@typescript-eslint/parser": "^8.0.0",
55
59
  "@vitest/runner": "^2.1.9",
56
60
  "@vitest/snapshot": "^2.1.9",
57
- "allure-js-commons": "^3.3.0",
58
- "allure-vitest": "^3.3.0",
61
+ "allure-js-commons": "^3.3.3",
62
+ "allure-vitest": "^3.3.3",
59
63
  "eslint": "^8.57.0",
60
64
  "eslint-config-prettier": "^9.1.0",
61
65
  "eslint-plugin-import": "^2.29.1",
@@ -1,25 +0,0 @@
1
- import { type AllureStore, type QualityGateConfig, type QualityGateRulesMeta, type QualityGateValidationResult, type QualityGateValidator } from "@allurereport/plugin-api";
2
- export declare abstract class AbstractQualityGateValidator implements QualityGateValidator {
3
- readonly limit: number;
4
- readonly meta?: QualityGateRulesMeta | undefined;
5
- constructor(limit: number, meta?: QualityGateRulesMeta | undefined);
6
- getTestResultsFilteredByMeta(store: AllureStore): Promise<import("@allurereport/core-api").TestResult[]>;
7
- abstract validate(store: AllureStore): Promise<QualityGateValidationResult>;
8
- }
9
- export declare class MaxFailuresValidator extends AbstractQualityGateValidator {
10
- validate(store: AllureStore): Promise<QualityGateValidationResult>;
11
- }
12
- export declare class MinTestsCountValidator extends AbstractQualityGateValidator {
13
- validate(store: AllureStore): Promise<QualityGateValidationResult>;
14
- }
15
- export declare class SuccessRateValidator extends AbstractQualityGateValidator {
16
- validate(store: AllureStore): Promise<QualityGateValidationResult>;
17
- }
18
- export declare class QualityGate {
19
- #private;
20
- readonly config?: QualityGateConfig | undefined;
21
- result: QualityGateValidationResult[];
22
- constructor(config?: QualityGateConfig | undefined);
23
- get exitCode(): 0 | 1;
24
- validate: (store: AllureStore) => Promise<void>;
25
- }
@@ -1,116 +0,0 @@
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 _QualityGate_instances, _QualityGate_mappedValidators_get, _QualityGate_createRulesValidator;
7
- import { filterSuccessful, filterUnsuccessful } from "@allurereport/core-api";
8
- export class AbstractQualityGateValidator {
9
- constructor(limit, meta) {
10
- this.limit = limit;
11
- this.meta = meta;
12
- }
13
- async getTestResultsFilteredByMeta(store) {
14
- const allTrs = await store.allTestResults();
15
- if (!this.meta) {
16
- return allTrs;
17
- }
18
- return allTrs.filter((tr) => {
19
- switch (this.meta?.type) {
20
- case "label":
21
- return tr.labels.some((label) => label.name === this.meta.name && label.value === this.meta.value);
22
- case "parameter":
23
- return tr.parameters.some((parameter) => parameter.name === this.meta.name && parameter.value === this.meta.value);
24
- default:
25
- return tr;
26
- }
27
- });
28
- }
29
- }
30
- export class MaxFailuresValidator extends AbstractQualityGateValidator {
31
- async validate(store) {
32
- const trs = (await this.getTestResultsFilteredByMeta(store)).filter((tr) => !tr.hidden).filter(filterUnsuccessful);
33
- return {
34
- success: trs.length <= this.limit,
35
- rule: "maxFailures",
36
- meta: this.meta,
37
- expected: this.limit,
38
- actual: trs.length,
39
- };
40
- }
41
- }
42
- export class MinTestsCountValidator extends AbstractQualityGateValidator {
43
- async validate(store) {
44
- const trs = (await this.getTestResultsFilteredByMeta(store)).filter((tr) => !tr.hidden);
45
- return {
46
- success: trs.length >= this.limit,
47
- rule: "minTestsCount",
48
- meta: this.meta,
49
- expected: this.limit,
50
- actual: trs.length,
51
- };
52
- }
53
- }
54
- export class SuccessRateValidator extends AbstractQualityGateValidator {
55
- async validate(store) {
56
- const knownIssues = await store.allKnownIssues();
57
- const trs = (await this.getTestResultsFilteredByMeta(store)).filter((tr) => !tr.hidden);
58
- const knownIssuesHistoryIds = knownIssues.map((ki) => ki.historyId);
59
- const unknown = trs.filter((tr) => !tr.historyId || !knownIssuesHistoryIds.includes(tr.historyId));
60
- const passed = unknown.filter(filterSuccessful);
61
- const rate = passed.length === 0 ? 0 : passed.length / unknown.length;
62
- return {
63
- success: rate >= this.limit,
64
- rule: "successRate",
65
- meta: this.meta,
66
- expected: this.limit,
67
- actual: rate,
68
- };
69
- }
70
- }
71
- export class QualityGate {
72
- constructor(config) {
73
- _QualityGate_instances.add(this);
74
- this.config = config;
75
- this.result = [];
76
- _QualityGate_createRulesValidator.set(this, (rules, meta) => {
77
- const validators = [];
78
- Object.keys(rules).forEach((rule) => {
79
- const Validator = __classPrivateFieldGet(this, _QualityGate_instances, "a", _QualityGate_mappedValidators_get)[rule];
80
- if (!Validator) {
81
- return;
82
- }
83
- const validator = new Validator(rules[rule], meta);
84
- validators.push(validator);
85
- });
86
- return validators;
87
- });
88
- this.validate = async (store) => {
89
- const { rules, enforce = [] } = this.config ?? {};
90
- const validators = [];
91
- const result = [];
92
- if (rules) {
93
- validators.push(...__classPrivateFieldGet(this, _QualityGate_createRulesValidator, "f").call(this, rules));
94
- }
95
- enforce.forEach((enforceConfig) => {
96
- const { rules: enforceRules, ...meta } = enforceConfig;
97
- validators.push(...__classPrivateFieldGet(this, _QualityGate_createRulesValidator, "f").call(this, enforceRules, meta));
98
- });
99
- for (const validator of validators) {
100
- result.push(await validator.validate(store));
101
- }
102
- this.result = result;
103
- };
104
- }
105
- get exitCode() {
106
- return this.result.some((res) => !res.success) ? 1 : 0;
107
- }
108
- }
109
- _QualityGate_createRulesValidator = new WeakMap(), _QualityGate_instances = new WeakSet(), _QualityGate_mappedValidators_get = function _QualityGate_mappedValidators_get() {
110
- return {
111
- maxFailures: MaxFailuresValidator,
112
- minTestsCount: MinTestsCountValidator,
113
- successRate: SuccessRateValidator,
114
- ...this.config?.validators,
115
- };
116
- };