@allurereport/core-api 3.5.0 → 3.6.1

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.
@@ -5,6 +5,10 @@ export declare const EMPTY_VALUE = "<Empty>";
5
5
  export declare const STATUS_ORDER: Record<string, number>;
6
6
  export declare const SEVERITY_ORDER: Record<string, number>;
7
7
  export declare const TRANSITION_ORDER: Record<string, number>;
8
+ export declare const DEFAULT_ERROR_CATEGORY_IDS: {
9
+ readonly productErrors: "_product_errors_default_category";
10
+ readonly testErrors: "_test_errors_default_category";
11
+ };
8
12
  export declare const DEFAULT_ERROR_CATEGORIES: CategoryRule[];
9
13
  export type TestCategories = {
10
14
  roots: string[];
@@ -19,12 +19,18 @@ export const TRANSITION_ORDER = {
19
19
  new: 2,
20
20
  fixed: 3,
21
21
  };
22
+ export const DEFAULT_ERROR_CATEGORY_IDS = {
23
+ productErrors: "_product_errors_default_category",
24
+ testErrors: "_test_errors_default_category",
25
+ };
22
26
  export const DEFAULT_ERROR_CATEGORIES = [
23
27
  {
28
+ id: DEFAULT_ERROR_CATEGORY_IDS.productErrors,
24
29
  name: "Product errors",
25
30
  matchers: { statuses: ["failed"] },
26
31
  },
27
32
  {
33
+ id: DEFAULT_ERROR_CATEGORY_IDS.testErrors,
28
34
  name: "Test errors",
29
35
  matchers: { statuses: ["broken"] },
30
36
  },
@@ -115,13 +121,18 @@ export const normalizeCategoriesConfig = (cfg) => {
115
121
  if (typeof rule.name !== "string" || !rule.name.trim()) {
116
122
  throw new Error(`categories[${index}].name must be non-empty string`);
117
123
  }
118
- const idValidationResult = normalizeCategoryId(rule.id ?? rule.name);
124
+ const defaultIdByName = new Map([
125
+ ["Product errors", DEFAULT_ERROR_CATEGORY_IDS.productErrors],
126
+ ["Test errors", DEFAULT_ERROR_CATEGORY_IDS.testErrors],
127
+ ]);
128
+ const effectiveId = rule.id ?? defaultIdByName.get(rule.name) ?? rule.name;
129
+ const idValidationResult = normalizeCategoryId(effectiveId);
119
130
  if (!idValidationResult.valid) {
120
131
  throw new Error(`categories[${index}].id ${idValidationResult.reason}`);
121
132
  }
122
133
  const normalizedId = idValidationResult.normalized;
123
134
  const sourceIds = sourceIdsByNormalizedId.get(normalizedId) ?? new Set();
124
- sourceIds.add(rule.id ?? rule.name);
135
+ sourceIds.add(effectiveId);
125
136
  sourceIdsByNormalizedId.set(normalizedId, sourceIds);
126
137
  const matchers = normalizeMatchers(rule, index);
127
138
  const existing = seen.get(normalizedId);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@allurereport/core-api",
3
- "version": "3.5.0",
3
+ "version": "3.6.1",
4
4
  "description": "Allure Core API",
5
5
  "keywords": [
6
6
  "allure"