@allurereport/core-api 3.0.0-beta.7 → 3.0.0-beta.9

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.
@@ -17,4 +17,5 @@ export declare const filterIncludedInSuccessRate: (t: {
17
17
  status: TestStatus;
18
18
  }) => boolean;
19
19
  export declare const emptyStatistic: () => Statistic;
20
- export declare const incrementStatistic: (statistic: Statistic, status: TestStatus) => void;
20
+ export declare const incrementStatistic: (statistic: Statistic, status: TestStatus, count?: number) => void;
21
+ export declare const mergeStatistic: (statistic: Statistic, additional: Statistic) => void;
package/dist/constants.js CHANGED
@@ -10,7 +10,14 @@ export const filterSuccessful = filterByStatus(successfulStatuses);
10
10
  export const filterUnsuccessful = filterByStatus(unsuccessfulStatuses);
11
11
  export const filterIncludedInSuccessRate = filterByStatus(includedInSuccessRate);
12
12
  export const emptyStatistic = () => ({ total: 0 });
13
- export const incrementStatistic = (statistic, status) => {
14
- statistic[status] = (statistic[status] ?? 0) + 1;
15
- statistic.total++;
13
+ export const incrementStatistic = (statistic, status, count = 1) => {
14
+ statistic[status] = (statistic[status] ?? 0) + count;
15
+ statistic.total += count;
16
+ };
17
+ export const mergeStatistic = (statistic, additional) => {
18
+ statusesList.forEach((status) => {
19
+ if (additional[status]) {
20
+ incrementStatistic(statistic, status, additional[status]);
21
+ }
22
+ });
16
23
  };
package/dist/history.d.ts CHANGED
@@ -1,11 +1,10 @@
1
- import type { TestStatus } from "./model.js";
1
+ import type { TestError, TestStatus } from "./model.js";
2
2
  export interface HistoryTestResult {
3
3
  id: string;
4
4
  name: string;
5
5
  fullName?: string;
6
6
  status: TestStatus;
7
- message?: string;
8
- trace?: string;
7
+ error?: TestError;
9
8
  start?: number;
10
9
  stop?: number;
11
10
  duration?: number;
package/dist/known.d.ts CHANGED
@@ -1,4 +1,5 @@
1
- import type { TestError, TestLink } from "./metadata.js";
1
+ import type { TestLink } from "./metadata.js";
2
+ import type { TestError } from "./model.js";
2
3
  export interface KnownTestFailure {
3
4
  historyId: string;
4
5
  issues?: TestLink[];
@@ -1,6 +1,3 @@
1
- import type { TestStatus } from "./model.js";
2
- export interface Location {
3
- }
4
1
  export interface TestLabel {
5
2
  name: string;
6
3
  value?: string;
@@ -17,13 +14,3 @@ export interface TestParameter {
17
14
  excluded: boolean;
18
15
  masked: boolean;
19
16
  }
20
- export interface TestError {
21
- id: string;
22
- message: string;
23
- trace?: string;
24
- status?: TestStatus;
25
- code?: string;
26
- location?: Location;
27
- tags: string[];
28
- expected?: boolean;
29
- }
package/dist/model.d.ts CHANGED
@@ -7,12 +7,17 @@ export interface SourceMetadata {
7
7
  [key: string]: any;
8
8
  };
9
9
  }
10
+ export interface TestError {
11
+ message?: string;
12
+ trace?: string;
13
+ actual?: string;
14
+ expected?: string;
15
+ }
10
16
  export interface TestResult {
11
17
  id: string;
12
18
  name: string;
13
19
  status: TestStatus;
14
- message?: string;
15
- trace?: string;
20
+ error?: TestError;
16
21
  testCase?: TestCase;
17
22
  fullName?: string;
18
23
  historyId?: string;
@@ -38,6 +43,7 @@ export interface TestResult {
38
43
  sourceMetadata: SourceMetadata;
39
44
  runSelector?: string;
40
45
  retries?: TestResult[];
46
+ categories?: any;
41
47
  }
42
48
  export interface TestFixtureResult {
43
49
  id: string;
@@ -45,8 +51,7 @@ export interface TestFixtureResult {
45
51
  type: "before" | "after";
46
52
  name: string;
47
53
  status: TestStatus;
48
- message?: string;
49
- trace?: string;
54
+ error?: TestError;
50
55
  start?: number;
51
56
  stop?: number;
52
57
  duration?: number;
@@ -58,12 +63,12 @@ export interface DefaultTestStepResult {
58
63
  name: string;
59
64
  parameters: TestParameter[];
60
65
  status: TestStatus;
61
- message?: string;
62
- trace?: string;
66
+ error?: TestError;
63
67
  start?: number;
64
68
  stop?: number;
65
69
  duration?: number;
66
70
  steps: TestStepResult[];
71
+ stepId?: string;
67
72
  type: "step";
68
73
  }
69
74
  export interface AttachmentLinkFile {
@@ -5,7 +5,9 @@ export type Comparator<T> = (a: T, b: T) => number;
5
5
  type Value<T, P> = T extends any ? (P extends keyof T ? T[P] : P extends "" ? T : never) : never;
6
6
  export declare const reverse: <T>(comparator: Comparator<T>) => Comparator<T>;
7
7
  export declare const nullsLast: <T extends {}>(compare: Comparator<T>) => Comparator<T | undefined>;
8
- export declare const compareBy: <T extends Record<string, any> = {}, P extends keyof T = keyof T>(property: P, compare: Comparator<Value<T, P>>) => Comparator<T>;
8
+ export declare const nullsFirst: <T extends {}>(compare: Comparator<T>) => Comparator<T | undefined>;
9
+ export declare const nullsDefault: <T extends {}>(compare: Comparator<T>, defaultValue: T) => Comparator<T | undefined>;
10
+ export declare const compareBy: <T extends Record<string, any> = {}, P extends keyof T = keyof T>(property: P, compare: Comparator<Value<T, P>>, defaultValue?: T[P]) => Comparator<T>;
9
11
  export declare const andThen: <T>(comparators: Comparator<T>[]) => Comparator<T>;
10
12
  export declare const alphabetically: SortFunction<string | undefined>;
11
13
  export declare const ordinal: SortFunction<number | undefined>;
@@ -5,8 +5,17 @@ export const reverse = (comparator) => {
5
5
  export const nullsLast = (compare) => {
6
6
  return (a, b) => a === b ? 0 : a === undefined || a === null ? 1 : b === undefined || b === null ? -1 : compare(a, b);
7
7
  };
8
- export const compareBy = (property, compare) => {
8
+ export const nullsFirst = (compare) => {
9
+ return (a, b) => a === b ? 0 : a === undefined || a === null ? -1 : b === undefined || b === null ? 1 : compare(a, b);
10
+ };
11
+ export const nullsDefault = (compare, defaultValue) => {
12
+ return (a, b) => compare(a ?? defaultValue, b ?? defaultValue);
13
+ };
14
+ export const compareBy = (property, compare, defaultValue) => {
9
15
  return nullsLast((a, b) => {
16
+ if (defaultValue !== undefined) {
17
+ return compare(a[property] ?? defaultValue, b[property] ?? defaultValue);
18
+ }
10
19
  if (property in a && property in b) {
11
20
  return compare(a[property], b[property]);
12
21
  }
@@ -32,7 +41,7 @@ export const byStatus = () => {
32
41
  });
33
42
  };
34
43
  export const byStatistic = () => {
35
- const compares = statusesList.map((status) => compareBy(status, reverse(ordinal())));
44
+ const compares = statusesList.map((status) => compareBy(status, reverse(ordinal()), 0));
36
45
  return nullsLast(andThen(compares));
37
46
  };
38
47
  export const byName = () => nullsLast(compareBy("name", alphabetically()));
@@ -1 +1 @@
1
- export declare const formatDuration: (duration: number | undefined) => string;
1
+ export declare const formatDuration: (duration?: number) => string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@allurereport/core-api",
3
- "version": "3.0.0-beta.7",
3
+ "version": "3.0.0-beta.9",
4
4
  "description": "Allure Core API",
5
5
  "keywords": [
6
6
  "allure"
@@ -32,7 +32,7 @@
32
32
  "@typescript-eslint/eslint-plugin": "^8.0.0",
33
33
  "@typescript-eslint/parser": "^8.0.0",
34
34
  "@vitest/runner": "^2.1.8",
35
- "allure-vitest": "^3.0.7",
35
+ "allure-vitest": "^3.0.9",
36
36
  "eslint": "^8.57.0",
37
37
  "eslint-config-prettier": "^9.1.0",
38
38
  "eslint-plugin-import": "^2.29.1",