@allurereport/core-api
Advanced tools
| export type DefaultLabelsConfig = Record<string, string | string[]>; |
| export {}; |
| import type { EnvironmentsConfig } from "../environment.js"; | ||
| import type { TestResult } from "../model.js"; | ||
| export declare const matchEnvironment: (envConfig: EnvironmentsConfig, tr: TestResult) => string; |
| export const matchEnvironment = (envConfig, tr) => { | ||
| return Object.entries(envConfig).find(([, { matcher }]) => matcher({ labels: tr.labels }))?.[0] ?? "default"; | ||
| }; |
| import type { TestStatus } from "../model.js"; | ||
| export declare const StatusByPriority: TestStatus[]; | ||
| export declare const statusToPriority: (status: TestStatus | undefined) => number; | ||
| export declare const getWorstStatus: (items: TestStatus[]) => TestStatus | undefined; |
| export const StatusByPriority = ["failed", "broken", "passed", "skipped", "unknown"]; | ||
| export const statusToPriority = (status) => { | ||
| if (!status) { | ||
| return -1; | ||
| } | ||
| return StatusByPriority.indexOf(status); | ||
| }; | ||
| export const getWorstStatus = (items) => { | ||
| if (items.length === 0) { | ||
| return; | ||
| } | ||
| return items.sort((a, b) => statusToPriority(a) - statusToPriority(b))[0]; | ||
| }; |
@@ -0,1 +1,3 @@ | ||
| import type { TestLabel } from "./metadata.js"; | ||
| import type { TestResult } from "./model.js"; | ||
| export interface EnvironmentItem { | ||
@@ -5,1 +7,14 @@ name: string; | ||
| } | ||
| export type ReportVariables = Record<string, string>; | ||
| export type EnvironmentMatcherPayload = { | ||
| labels: TestLabel[]; | ||
| }; | ||
| export type EnvironmentDescriptor = { | ||
| variables?: ReportVariables; | ||
| matcher: (payload: EnvironmentMatcherPayload) => boolean; | ||
| }; | ||
| export type EnvironmentsConfig = Record<string, EnvironmentDescriptor>; | ||
| export type EnvTestGroup = Pick<TestResult, "fullName" | "name" | "status"> & { | ||
| id: string; | ||
| testResultsByEnv: Record<string, TestResult>; | ||
| }; |
+3
-0
@@ -10,2 +10,3 @@ export type * from "./aggregate.js"; | ||
| export type * from "./testPlan.js"; | ||
| export type * from "./config.js"; | ||
| export * from "./utils/step.js"; | ||
@@ -18,1 +19,3 @@ export type * from "./utils/tree.js"; | ||
| export * from "./utils/testplan.js"; | ||
| export * from "./utils/status.js"; | ||
| export * from "./utils/environment.js"; |
+2
-0
@@ -8,1 +8,3 @@ export * from "./constants.js"; | ||
| export * from "./utils/testplan.js"; | ||
| export * from "./utils/status.js"; | ||
| export * from "./utils/environment.js"; |
+1
-0
@@ -22,2 +22,3 @@ import type { TestLabel, TestLink, TestParameter } from "./metadata.js"; | ||
| testCase?: TestCase; | ||
| environment?: string; | ||
| fullName?: string; | ||
@@ -24,0 +25,0 @@ historyId?: string; |
+2
-1
| { | ||
| "name": "@allurereport/core-api", | ||
| "version": "3.0.0-beta.9", | ||
| "version": "3.0.0-beta.10", | ||
| "description": "Allure Core API", | ||
@@ -35,2 +35,3 @@ "keywords": [ | ||
| "@vitest/runner": "^2.1.8", | ||
| "@vitest/snapshot": "^2.1.8", | ||
| "allure-vitest": "^3.0.9", | ||
@@ -37,0 +38,0 @@ "eslint": "^8.57.0", |
17989
12.13%42
16.67%454
11.27%18
5.88%