@allurereport/core-api 3.0.0-beta.12 → 3.0.0-beta.14
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/aggregate.d.ts
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
1
|
import type { EnvironmentsConfig } from "../environment.js";
|
|
2
|
-
import type { TestResult } from "../model.js";
|
|
2
|
+
import type { TestEnvGroup, TestResult } from "../model.js";
|
|
3
|
+
export declare const DEFAULT_ENVIRONMENT = "default";
|
|
3
4
|
export declare const matchEnvironment: (envConfig: EnvironmentsConfig, tr: TestResult) => string;
|
|
5
|
+
export declare const getRealEnvsCount: (group: TestEnvGroup) => number;
|
|
@@ -1,3 +1,12 @@
|
|
|
1
|
+
export const DEFAULT_ENVIRONMENT = "default";
|
|
1
2
|
export const matchEnvironment = (envConfig, tr) => {
|
|
2
|
-
return Object.entries(envConfig).find(([, { matcher }]) => matcher({ labels: tr.labels }))?.[0] ??
|
|
3
|
+
return (Object.entries(envConfig).find(([, { matcher }]) => matcher({ labels: tr.labels }))?.[0] ?? DEFAULT_ENVIRONMENT);
|
|
4
|
+
};
|
|
5
|
+
export const getRealEnvsCount = (group) => {
|
|
6
|
+
const { testResultsByEnv = {} } = group ?? {};
|
|
7
|
+
const envsCount = Object.keys(testResultsByEnv).length ?? 0;
|
|
8
|
+
if (envsCount <= 1 && DEFAULT_ENVIRONMENT in testResultsByEnv) {
|
|
9
|
+
return 0;
|
|
10
|
+
}
|
|
11
|
+
return envsCount;
|
|
3
12
|
};
|