@allurereport/web-awesome 3.0.0-beta.18 → 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.
Files changed (44) hide show
  1. package/dist/multi/app-87488b008bf93bf0b234.js +2 -0
  2. package/dist/multi/{app-b58a8b2733d390b78773.js.LICENSE.txt → app-87488b008bf93bf0b234.js.LICENSE.txt} +2 -0
  3. package/dist/multi/manifest.json +20 -20
  4. package/dist/multi/{styles-3610e3d9923b6a2a1c67.css → styles-88a1cf6726b2a478108e.css} +2 -2
  5. package/dist/single/app-af34e3cec116175b6d9a.js +2 -0
  6. package/dist/single/{app-51defb8852956a2ff6f1.js.LICENSE.txt → app-af34e3cec116175b6d9a.js.LICENSE.txt} +2 -0
  7. package/dist/single/manifest.json +1 -1
  8. package/package.json +5 -6
  9. package/src/components/Charts/index.tsx +46 -7
  10. package/src/components/Charts/styles.scss +2 -2
  11. package/src/components/Header/CiInfo/index.tsx +45 -29
  12. package/src/components/Header/index.tsx +1 -4
  13. package/src/components/ReportBody/index.tsx +1 -2
  14. package/src/components/ReportMetadata/MetadataSummary.tsx +1 -2
  15. package/src/components/SplitLayout/index.tsx +0 -2
  16. package/src/components/TestResult/TrError/index.tsx +6 -5
  17. package/src/components/TestResult/TrInfo/TrInfoStatuses.tsx +1 -1
  18. package/src/components/TestResult/TrInfo/index.tsx +1 -1
  19. package/src/components/TestResult/TrPrevStatuses/index.tsx +2 -2
  20. package/src/components/TestResult/TrSeverity/index.tsx +1 -1
  21. package/src/components/TestResult/TrStatus/index.tsx +1 -1
  22. package/test/components/Header/CiInfo.test.tsx +79 -53
  23. package/test/components/Header.test.tsx +1 -6
  24. package/vitest.config.ts +2 -16
  25. package/dist/multi/app-b58a8b2733d390b78773.js +0 -2
  26. package/dist/single/app-51defb8852956a2ff6f1.js +0 -2
  27. /package/dist/multi/{173.app-b58a8b2733d390b78773.js → 173.app-87488b008bf93bf0b234.js} +0 -0
  28. /package/dist/multi/{174.app-b58a8b2733d390b78773.js → 174.app-87488b008bf93bf0b234.js} +0 -0
  29. /package/dist/multi/{252.app-b58a8b2733d390b78773.js → 252.app-87488b008bf93bf0b234.js} +0 -0
  30. /package/dist/multi/{282.app-b58a8b2733d390b78773.js → 282.app-87488b008bf93bf0b234.js} +0 -0
  31. /package/dist/multi/{29.app-b58a8b2733d390b78773.js → 29.app-87488b008bf93bf0b234.js} +0 -0
  32. /package/dist/multi/{416.app-b58a8b2733d390b78773.js → 416.app-87488b008bf93bf0b234.js} +0 -0
  33. /package/dist/multi/{527.app-b58a8b2733d390b78773.js → 527.app-87488b008bf93bf0b234.js} +0 -0
  34. /package/dist/multi/{600.app-b58a8b2733d390b78773.js → 600.app-87488b008bf93bf0b234.js} +0 -0
  35. /package/dist/multi/{605.app-b58a8b2733d390b78773.js → 605.app-87488b008bf93bf0b234.js} +0 -0
  36. /package/dist/multi/{638.app-b58a8b2733d390b78773.js → 638.app-87488b008bf93bf0b234.js} +0 -0
  37. /package/dist/multi/{672.app-b58a8b2733d390b78773.js → 672.app-87488b008bf93bf0b234.js} +0 -0
  38. /package/dist/multi/{686.app-b58a8b2733d390b78773.js → 686.app-87488b008bf93bf0b234.js} +0 -0
  39. /package/dist/multi/{725.app-b58a8b2733d390b78773.js → 725.app-87488b008bf93bf0b234.js} +0 -0
  40. /package/dist/multi/{741.app-b58a8b2733d390b78773.js → 741.app-87488b008bf93bf0b234.js} +0 -0
  41. /package/dist/multi/{755.app-b58a8b2733d390b78773.js → 755.app-87488b008bf93bf0b234.js} +0 -0
  42. /package/dist/multi/{894.app-b58a8b2733d390b78773.js → 894.app-87488b008bf93bf0b234.js} +0 -0
  43. /package/dist/multi/{943.app-b58a8b2733d390b78773.js → 943.app-87488b008bf93bf0b234.js} +0 -0
  44. /package/dist/multi/{980.app-b58a8b2733d390b78773.js → 980.app-87488b008bf93bf0b234.js} +0 -0
@@ -1,3 +1,5 @@
1
+ /*! @license DOMPurify 3.2.6 | (c) Cure53 and other contributors | Released under the Apache license 2.0 and Mozilla Public License 2.0 | github.com/cure53/DOMPurify/blob/3.2.6/LICENSE */
2
+
1
3
  /**
2
4
  * Prism: Lightweight, robust, elegant syntax highlighting
3
5
  *
@@ -1,3 +1,3 @@
1
1
  {
2
- "main.js": "app-51defb8852956a2ff6f1.js"
2
+ "main.js": "app-af34e3cec116175b6d9a.js"
3
3
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@allurereport/web-awesome",
3
- "version": "3.0.0-beta.18",
3
+ "version": "3.0.0-beta.19",
4
4
  "description": "The static files for Allure Awesome Report",
5
5
  "keywords": [
6
6
  "allure",
@@ -31,10 +31,10 @@
31
31
  "IE 11"
32
32
  ],
33
33
  "dependencies": {
34
- "@allurereport/core-api": "3.0.0-beta.18",
35
- "@allurereport/plugin-api": "3.0.0-beta.18",
36
- "@allurereport/web-commons": "3.0.0-beta.18",
37
- "@allurereport/web-components": "3.0.0-beta.18",
34
+ "@allurereport/core-api": "3.0.0-beta.19",
35
+ "@allurereport/plugin-api": "3.0.0-beta.19",
36
+ "@allurereport/web-commons": "3.0.0-beta.19",
37
+ "@allurereport/web-components": "3.0.0-beta.19",
38
38
  "@preact/signals": "^1.3.0",
39
39
  "clsx": "^2.1.1",
40
40
  "d3-shape": "^3.2.0",
@@ -69,7 +69,6 @@
69
69
  "@vitest/runner": "^3.2.4",
70
70
  "@vitest/snapshot": "^3.2.4",
71
71
  "allure-vitest": "^3.3.2",
72
- "ansi-to-html": "^0.7.2",
73
72
  "autoprefixer": "^10.4.20",
74
73
  "babel-loader": "^9.2.1",
75
74
  "babel-plugin-prismjs": "^2.1.0",
@@ -1,13 +1,16 @@
1
1
  /* eslint-disable @typescript-eslint/no-unsafe-argument */
2
- import { ChartType } from "@allurereport/core-api";
3
- import { type UIChartData, capitalize } from "@allurereport/web-commons";
2
+ import { ChartType, capitalize } from "@allurereport/core-api";
3
+ import { type UIChartData } from "@allurereport/web-commons";
4
4
  import {
5
+ BarChartWidget,
5
6
  ComingSoonChartWidget,
6
7
  Grid,
7
8
  GridItem,
9
+ HeatMapWidget,
8
10
  Loadable,
9
11
  PageLoader,
10
12
  SuccessRatePieChart,
13
+ TreeMapChartWidget,
11
14
  TrendChartWidget,
12
15
  Widget,
13
16
  } from "@allurereport/web-components";
@@ -24,7 +27,6 @@ const getChartWidgetByType = (
24
27
  case ChartType.Trend: {
25
28
  const type = t(`trend.type.${chartData.dataType}`);
26
29
  const title = chartData.title ?? t("trend.title", { type: capitalize(type) });
27
- const translations = empty("no-results");
28
30
 
29
31
  return (
30
32
  <TrendChartWidget
@@ -34,7 +36,7 @@ const getChartWidgetByType = (
34
36
  slices={chartData.slices}
35
37
  min={chartData.min}
36
38
  max={chartData.max}
37
- translations={{ "no-results": translations }}
39
+ translations={{ "no-results": empty("no-results") }}
38
40
  />
39
41
  );
40
42
  }
@@ -51,10 +53,47 @@ const getChartWidgetByType = (
51
53
  </Widget>
52
54
  );
53
55
  }
54
- case ChartType.HeatMap:
55
- case ChartType.Bar:
56
- case ChartType.Funnel:
56
+ case ChartType.Bar: {
57
+ const type = t(`bar.type.${chartData.dataType}`);
58
+ const title = chartData.title ?? t("bar.title", { type: capitalize(type) });
59
+
60
+ return (
61
+ <BarChartWidget
62
+ title={title}
63
+ mode={chartData.mode}
64
+ data={chartData.data}
65
+ keys={chartData.keys}
66
+ indexBy={chartData.indexBy}
67
+ colors={chartData.colors}
68
+ groupMode={chartData.groupMode}
69
+ translations={{ "no-results": empty("no-results") }}
70
+ />
71
+ );
72
+ }
57
73
  case ChartType.TreeMap: {
74
+ return (
75
+ <TreeMapChartWidget
76
+ data={chartData.treeMap}
77
+ title={chartData.title}
78
+ formatLegend={chartData.formatLegend}
79
+ colors={chartData.colors}
80
+ legendDomain={chartData.legendDomain}
81
+ tooltipRows={chartData.tooltipRows}
82
+ translations={{ "no-results": empty("no-results") }}
83
+ />
84
+ );
85
+ }
86
+ case ChartType.HeatMap: {
87
+ return (
88
+ <HeatMapWidget
89
+ title={chartData.title}
90
+ data={chartData.data}
91
+ colors={chartData.colors}
92
+ translations={{ "no-results": empty("no-results") }}
93
+ />
94
+ );
95
+ }
96
+ default: {
58
97
  const title = chartData.title ?? t(`charts.${chartData.type}.title`, { fallback: `${chartData.type} Chart` });
59
98
 
60
99
  return <ComingSoonChartWidget title={title} />;
@@ -7,12 +7,12 @@
7
7
 
8
8
  .overview-grid {
9
9
  display: grid;
10
- gap: 24px;
10
+ gap: 12px;
11
11
  grid-template-columns: repeat(auto-fit, minmax(min(100%, calc(50% - 12px)), 1fr));
12
12
  }
13
13
 
14
14
  .overview-grid-item {
15
- padding: 12px;
15
+ padding: 4px;
16
16
  width: 100%;
17
17
  }
18
18
 
@@ -1,48 +1,64 @@
1
1
  import { CiDescriptor, CiType } from "@allurereport/core-api";
2
+ import { getReportOptions } from "@allurereport/web-commons";
2
3
  import { SvgIcon, Text, allureIcons } from "@allurereport/web-components";
3
4
  import type { ClassValue } from "clsx";
4
5
  import clsx from "clsx";
5
- import { useMemo } from "preact/hooks";
6
+ import type { AwesomeReportOptions } from "../../../../types";
6
7
  import * as styles from "./styles.scss";
7
8
 
8
9
  interface CiInfoProps {
9
- ci: CiDescriptor;
10
10
  className?: ClassValue;
11
11
  }
12
12
 
13
- export const CiInfo = ({ ci, className }: CiInfoProps) => {
14
- const icon = useMemo(() => {
15
- switch (ci.type) {
16
- case CiType.Amazon:
17
- return allureIcons.amazon;
18
- case CiType.Azure:
19
- return allureIcons.azure;
20
- case CiType.Bitbucket:
21
- return allureIcons.bitbucket;
22
- case CiType.Circle:
23
- return allureIcons.circleci;
24
- case CiType.Drone:
25
- return allureIcons.drone;
26
- case CiType.Github:
27
- return allureIcons.github;
28
- case CiType.Gitlab:
29
- return allureIcons.gitlab;
30
- case CiType.Jenkins:
31
- return allureIcons.jenkins;
32
- default:
33
- return undefined;
34
- }
35
- }, [ci]);
36
- const link = ci.pullRequestUrl ?? ci.jobUrl ?? ci.jobRunUrl;
37
- const label = ci.pullRequestName ?? ci.jobName ?? ci.jobRunName ?? link;
13
+ interface CiIconProps {
14
+ type: CiDescriptor["type"];
15
+ }
16
+
17
+ export const CiIcon = ({ type }: CiIconProps) => {
18
+ const iconCommonProps = {
19
+ width: 16,
20
+ height: 16,
21
+ };
22
+
23
+ switch (type) {
24
+ case CiType.Amazon:
25
+ return <SvgIcon id={allureIcons.amazon} {...iconCommonProps} />;
26
+ case CiType.Azure:
27
+ return <SvgIcon id={allureIcons.azure} {...iconCommonProps} />;
28
+ case CiType.Bitbucket:
29
+ return <SvgIcon id={allureIcons.bitbucket} {...iconCommonProps} />;
30
+ case CiType.Circle:
31
+ return <SvgIcon id={allureIcons.circleci} {...iconCommonProps} />;
32
+ case CiType.Drone:
33
+ return <SvgIcon id={allureIcons.drone} {...iconCommonProps} />;
34
+ case CiType.Github:
35
+ return <SvgIcon id={allureIcons.github} {...iconCommonProps} />;
36
+ case CiType.Gitlab:
37
+ return <SvgIcon id={allureIcons.gitlab} {...iconCommonProps} />;
38
+ case CiType.Jenkins:
39
+ return <SvgIcon id={allureIcons.jenkins} {...iconCommonProps} />;
40
+ default:
41
+ return null;
42
+ }
43
+ };
44
+
45
+ export const CiInfo = ({ className }: CiInfoProps) => {
46
+ const { ci } = getReportOptions<AwesomeReportOptions>();
47
+
48
+ if (!ci) {
49
+ return null;
50
+ }
51
+
52
+ const link = ci.pullRequestUrl || ci.jobRunUrl || ci.jobUrl;
53
+ const label = ci.pullRequestName || ci.jobRunName || ci.jobName || link;
38
54
 
39
55
  if (!link) {
40
56
  return null;
41
57
  }
42
58
 
43
59
  return (
44
- <a className={clsx(styles["ci-info"], className)} href={link}>
45
- {icon && <SvgIcon id={icon} width={16} height={16} />}
60
+ <a className={clsx(styles["ci-info"], className)} href={link} target="_blank">
61
+ <CiIcon type={ci.type} />
46
62
  <Text type={"paragraph"} size={"m"} bold>
47
63
  {label}
48
64
  </Text>
@@ -1,4 +1,3 @@
1
- import { getReportOptions } from "@allurereport/web-commons";
2
1
  import type { ClassValue } from "clsx";
3
2
  import clsx from "clsx";
4
3
  import { HeaderControls } from "@/components/HeaderControls";
@@ -7,7 +6,6 @@ import { TrBreadcrumbs } from "@/components/TestResult/TrHeader/TrBreadcrumbs";
7
6
  import { route } from "@/stores/router";
8
7
  import { availableSections } from "@/stores/sections";
9
8
  import { testResultStore } from "@/stores/testResults";
10
- import type { AwesomeReportOptions } from "../../../types";
11
9
  import { CiInfo } from "./CiInfo";
12
10
  import * as styles from "./styles.scss";
13
11
 
@@ -17,12 +15,11 @@ interface HeaderProps {
17
15
 
18
16
  export const Header = ({ className }: HeaderProps) => {
19
17
  const testResultId = route.value.params?.testResultId;
20
- const { ci } = getReportOptions<AwesomeReportOptions>();
21
18
 
22
19
  return (
23
20
  <div className={clsx(styles.above, className)}>
24
21
  {Boolean(availableSections.value?.length) && <SectionPicker />}
25
- {!testResultId && ci && <CiInfo ci={ci} />}
22
+ {!testResultId && <CiInfo />}
26
23
  {testResultId && <TrBreadcrumbs testResult={testResultStore.value?.data?.[testResultId]} />}
27
24
  <HeaderControls className={styles.right} />
28
25
  </div>
@@ -1,5 +1,4 @@
1
- import { statusesList } from "@allurereport/core-api";
2
- import { capitalize } from "@allurereport/web-commons";
1
+ import { capitalize, statusesList } from "@allurereport/core-api";
3
2
  import { Counter, Loadable } from "@allurereport/web-components";
4
3
  import { reportStatsStore, statsByEnvStore } from "@/stores";
5
4
  import { currentEnvironment } from "@/stores/env";
@@ -1,5 +1,4 @@
1
- import { type Statistic, statusesList } from "@allurereport/core-api";
2
- import { capitalize } from "@allurereport/web-commons";
1
+ import { type Statistic, capitalize, statusesList } from "@allurereport/core-api";
3
2
  import { computed } from "@preact/signals";
4
3
  import type { FunctionalComponent } from "preact";
5
4
  import MetadataItem, { type MetadataProps } from "@/components/ReportMetadata/MetadataItem";
@@ -33,9 +33,7 @@ const Loader = () => {
33
33
  export const SplitLayout = () => {
34
34
  const testResultId = route.value.params?.testResultId ?? null;
35
35
  const [cachedMain, setCachedMain] = useState<JSX.Element | null>(null);
36
-
37
36
  const { t } = useI18n("controls");
38
-
39
37
  const leftSide = (
40
38
  <Loadable source={treeStore} renderLoader={() => <PageLoader />} renderData={() => <MainReportWrapper />} />
41
39
  );
@@ -1,6 +1,6 @@
1
- import type { TestError, TestResult, TestStatus } from "@allurereport/core-api";
1
+ import type { TestError, TestStatus } from "@allurereport/core-api";
2
+ import { ansiToHTML } from "@allurereport/web-commons";
2
3
  import { Button, Code, IconButton, Text, TooltipWrapper, allureIcons } from "@allurereport/web-components";
3
- import AnsiToHtml from "ansi-to-html";
4
4
  import clsx from "clsx";
5
5
  import { type FunctionalComponent } from "preact";
6
6
  import { useState } from "preact/hooks";
@@ -11,15 +11,16 @@ import { copyToClipboard } from "@/utils/copyToClipboard";
11
11
  import * as styles from "./styles.scss";
12
12
 
13
13
  const TrErrorTrace = ({ trace }: { trace: string }) => {
14
- const ansiTrace = new AnsiToHtml({
14
+ const sanitizedTrace = ansiToHTML(trace, {
15
15
  fg: "var(--on-text-primary)",
16
16
  colors: {},
17
- }).toHtml(trace);
17
+ });
18
+
18
19
  return (
19
20
  <div data-testid="test-result-error-trace" className={styles["test-result-error-trace"]}>
20
21
  <Code size={"s"} type={"ui"}>
21
22
  {/* eslint-disable-next-line react/no-danger */}
22
- <pre dangerouslySetInnerHTML={{ __html: ansiTrace }}>{ansiTrace}</pre>
23
+ <pre dangerouslySetInnerHTML={{ __html: sanitizedTrace }} />
23
24
  </Code>
24
25
  </div>
25
26
  );
@@ -1,4 +1,4 @@
1
- import { capitalize } from "@allurereport/web-commons";
1
+ import { capitalize } from "@allurereport/core-api";
2
2
  import { SvgIcon, Text, allureIcons } from "@allurereport/web-components";
3
3
  import { type FunctionalComponent } from "preact";
4
4
  import { useI18n } from "@/stores";
@@ -70,7 +70,7 @@ export const TrInfo: FunctionalComponent<TrInfoProps> = ({ testResult }) => {
70
70
  </TrTab>
71
71
  <Loadable<Record<string, TestEnvGroup>, TestEnvGroup | undefined>
72
72
  source={testEnvGroupsStore}
73
- transformData={(groups) => groups[testResult.testCase.id]}
73
+ transformData={(groups) => groups?.[testResult?.testCase?.id]}
74
74
  renderData={(group) => {
75
75
  const envsCount = getRealEnvsCount(group);
76
76
 
@@ -1,5 +1,5 @@
1
- import { type HistoryTestResult } from "@allurereport/core-api";
2
- import { capitalize, getReportOptions } from "@allurereport/web-commons";
1
+ import { type HistoryTestResult, capitalize } from "@allurereport/core-api";
2
+ import { getReportOptions } from "@allurereport/web-commons";
3
3
  import { SvgIcon, Text, TooltipWrapper, allureIcons } from "@allurereport/web-components";
4
4
  import type { FunctionalComponent } from "preact";
5
5
  import type { AwesomeReportOptions, AwesomeTestResult } from "types";
@@ -1,4 +1,4 @@
1
- import { capitalize } from "@allurereport/web-commons";
1
+ import { capitalize } from "@allurereport/core-api";
2
2
  import { SvgIcon, Text, allureIcons } from "@allurereport/web-components";
3
3
  import clsx from "clsx";
4
4
  import { useI18n } from "@/stores/locale";
@@ -1,5 +1,5 @@
1
1
  import type { TestStatus } from "@allurereport/core-api";
2
- import { capitalize } from "@allurereport/web-commons";
2
+ import { capitalize } from "@allurereport/core-api";
3
3
  import { Text, TreeItemIcon } from "@allurereport/web-components";
4
4
  import clsx from "clsx";
5
5
  import { useI18n } from "@/stores";
@@ -1,7 +1,8 @@
1
- import { CiDescriptor, CiType } from "@allurereport/core-api";
1
+ import { CiType } from "@allurereport/core-api";
2
+ import { getReportOptions } from "@allurereport/web-commons";
2
3
  import { cleanup, render, screen } from "@testing-library/preact";
3
4
  import { h } from "preact";
4
- import { beforeEach, describe, expect, it, vi } from "vitest";
5
+ import { type Mock, beforeEach, describe, expect, it, vi } from "vitest";
5
6
  import { CiInfo } from "@/components/Header/CiInfo";
6
7
 
7
8
  const fixtures = {
@@ -31,8 +32,15 @@ vi.mock("@allurereport/web-components", async () => {
31
32
  },
32
33
  };
33
34
  });
35
+ vi.mock("@allurereport/web-commons", async (importOriginal) => {
36
+ return {
37
+ ...(await importOriginal()),
38
+ getReportOptions: vi.fn(),
39
+ };
40
+ });
34
41
 
35
42
  beforeEach(() => {
43
+ vi.clearAllMocks();
36
44
  cleanup();
37
45
  });
38
46
 
@@ -50,101 +58,119 @@ describe("components > Header > CiInfo", () => {
50
58
  ];
51
59
 
52
60
  for (const type of ciTypes) {
53
- const ci = {
54
- pullRequestUrl: fixtures.pullRequestUrl,
55
- type,
56
- } as CiDescriptor;
61
+ (getReportOptions as Mock).mockReturnValueOnce({
62
+ ci: {
63
+ pullRequestUrl: fixtures.pullRequestUrl,
64
+ type,
65
+ },
66
+ });
57
67
 
58
68
  cleanup();
59
- render(<CiInfo ci={ci} />);
69
+ render(<CiInfo />);
60
70
 
61
71
  expect(screen.getByTestId("icon")).toHaveTextContent(type);
62
72
  }
63
73
  });
64
74
 
65
75
  it("shouldn't render icon for unknown CI", () => {
66
- const ci = {
67
- type: undefined,
68
- } as CiDescriptor;
76
+ (getReportOptions as Mock).mockReturnValueOnce({
77
+ ci: {
78
+ type: undefined,
79
+ },
80
+ });
69
81
 
70
- render(<CiInfo ci={ci} />);
82
+ render(<CiInfo />);
71
83
 
72
84
  expect(screen.queryByTestId("icon")).not.toBeInTheDocument();
73
85
  });
74
86
 
75
87
  it("should render there is no link to use", () => {
76
- const ci = {} as CiDescriptor;
88
+ (getReportOptions as Mock).mockReturnValueOnce({
89
+ ci: {},
90
+ });
77
91
 
78
- render(<CiInfo ci={ci} />);
92
+ render(<CiInfo />);
79
93
 
80
94
  expect(screen.queryByRole("link")).not.toBeInTheDocument();
81
95
  });
82
96
 
83
97
  it("should presence pull request url as href when provided", () => {
84
- const ci = {
85
- pullRequestUrl: fixtures.pullRequestUrl,
86
- jobUrl: fixtures.jobUrl,
87
- jobRunUrl: fixtures.jobRunUrl,
88
- } as CiDescriptor;
98
+ (getReportOptions as Mock).mockReturnValueOnce({
99
+ ci: {
100
+ pullRequestUrl: fixtures.pullRequestUrl,
101
+ jobUrl: fixtures.jobUrl,
102
+ jobRunUrl: fixtures.jobRunUrl,
103
+ },
104
+ });
89
105
 
90
- render(<CiInfo ci={ci} />);
106
+ render(<CiInfo />);
91
107
 
92
108
  expect(screen.getByRole("link")).toHaveAttribute("href", fixtures.pullRequestUrl);
93
109
  });
94
110
 
95
- it("should presence use job url as href when provided", () => {
96
- const ci = {
97
- jobUrl: fixtures.jobUrl,
98
- jobRunUrl: fixtures.jobRunUrl,
99
- } as CiDescriptor;
111
+ it("should presence use job run url as href when provided", () => {
112
+ (getReportOptions as Mock).mockReturnValueOnce({
113
+ ci: {
114
+ jobUrl: fixtures.jobUrl,
115
+ jobRunUrl: fixtures.jobRunUrl,
116
+ },
117
+ });
100
118
 
101
- render(<CiInfo ci={ci} />);
119
+ render(<CiInfo />);
102
120
 
103
- expect(screen.getByRole("link")).toHaveAttribute("href", fixtures.jobUrl);
121
+ expect(screen.getByRole("link")).toHaveAttribute("href", fixtures.jobRunUrl);
104
122
  });
105
123
 
106
- it("should use job run url as href when provided", () => {
107
- const ci = {
108
- jobRunUrl: fixtures.jobRunUrl,
109
- } as CiDescriptor;
124
+ it("should use job url as href when provided", () => {
125
+ (getReportOptions as Mock).mockReturnValueOnce({
126
+ ci: {
127
+ jobRunUrl: fixtures.jobRunUrl,
128
+ },
129
+ });
110
130
 
111
- render(<CiInfo ci={ci} />);
131
+ render(<CiInfo />);
112
132
 
113
133
  expect(screen.getByRole("link")).toHaveAttribute("href", fixtures.jobRunUrl);
114
134
  });
115
135
 
116
136
  it("should presence pull request name as text when provided", () => {
117
- const ci = {
118
- pullRequestUrl: fixtures.pullRequestUrl,
119
- pullRequestName: fixtures.pullRequestName,
120
- jobName: fixtures.jobName,
121
- jobRunName: fixtures.jobRunName,
122
- } as CiDescriptor;
137
+ (getReportOptions as Mock).mockReturnValueOnce({
138
+ ci: {
139
+ pullRequestUrl: fixtures.pullRequestUrl,
140
+ pullRequestName: fixtures.pullRequestName,
141
+ jobName: fixtures.jobName,
142
+ jobRunName: fixtures.jobRunName,
143
+ },
144
+ });
123
145
 
124
- render(<CiInfo ci={ci} />);
146
+ render(<CiInfo />);
125
147
 
126
148
  expect(screen.getByRole("link")).toHaveTextContent(fixtures.pullRequestName);
127
149
  });
128
150
 
129
- it("should presence job name as text when provided", () => {
130
- const ci = {
131
- jobUrl: fixtures.jobUrl,
132
- jobName: fixtures.jobName,
133
- jobRunName: fixtures.jobRunName,
134
- } as CiDescriptor;
151
+ it("should presence job run name as text when provided", () => {
152
+ (getReportOptions as Mock).mockReturnValueOnce({
153
+ ci: {
154
+ jobUrl: fixtures.jobUrl,
155
+ jobName: fixtures.jobName,
156
+ jobRunName: fixtures.jobRunName,
157
+ },
158
+ });
135
159
 
136
- render(<CiInfo ci={ci} />);
160
+ render(<CiInfo />);
137
161
 
138
- expect(screen.getByRole("link")).toHaveTextContent(fixtures.jobName);
162
+ expect(screen.getByRole("link")).toHaveTextContent(fixtures.jobRunName);
139
163
  });
140
164
 
141
- it("should presence job run name as text when provided", () => {
142
- const ci = {
143
- jobRunUrl: fixtures.jobRunUrl,
144
- jobRunName: fixtures.jobRunName,
145
- } as CiDescriptor;
146
-
147
- render(<CiInfo ci={ci} />);
165
+ it("should presence job name as text when provided", () => {
166
+ (getReportOptions as Mock).mockReturnValueOnce({
167
+ ci: {
168
+ jobRunUrl: fixtures.jobRunUrl,
169
+ jobRunName: fixtures.jobRunName,
170
+ },
171
+ });
172
+
173
+ render(<CiInfo />);
148
174
 
149
175
  expect(screen.getByRole("link")).toHaveTextContent(fixtures.jobRunName);
150
176
  });
@@ -75,12 +75,7 @@ describe("components > Header", () => {
75
75
 
76
76
  render(<Header />);
77
77
 
78
- expect(CiInfo).toHaveBeenCalledWith(
79
- {
80
- ci: fixtures.ci,
81
- },
82
- expect.anything(),
83
- );
78
+ expect(CiInfo).toHaveBeenCalled();
84
79
  expect(screen.getByTestId("ci-info")).toBeInTheDocument();
85
80
  });
86
81
 
package/vitest.config.ts CHANGED
@@ -1,21 +1,7 @@
1
1
  import { createRequire } from "node:module";
2
- import { platform } from "node:os";
3
2
  import { defineConfig } from "vitest/config";
4
-
5
- const getOsLabel = () => {
6
- switch (platform()) {
7
- case "win32":
8
- return "Windows";
9
- case "darwin":
10
- return "macOS";
11
- case "linux":
12
- return "Linux";
13
- default:
14
- return platform();
15
- }
16
- };
17
3
  import { resolve } from "path";
18
- import { preact } from "@preact/preset-vite"
4
+ import { preact } from "@preact/preset-vite";
19
5
 
20
6
  const require = createRequire(import.meta.url);
21
7
 
@@ -38,7 +24,7 @@ export default defineConfig({
38
24
  "default",
39
25
  [
40
26
  "allure-vitest/reporter",
41
- { resultsDir: "./out/allure-results", globalLabels: [{ name: "module", value: "web-awesome" }, { name: "os", value: getOsLabel() }] },
27
+ { resultsDir: "./out/allure-results", globalLabels: [{ name: "module", value: "web-awesome" }] },
42
28
  ],
43
29
  ],
44
30
  },