@allurereport/web-awesome 3.0.0-beta.9 → 3.0.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.
- package/dist/multi/173.app-bae2a0fe5738d77cd976.js +1 -0
- package/dist/multi/174.app-bae2a0fe5738d77cd976.js +1 -0
- package/dist/multi/252.app-bae2a0fe5738d77cd976.js +1 -0
- package/dist/multi/282.app-bae2a0fe5738d77cd976.js +1 -0
- package/dist/multi/29.app-bae2a0fe5738d77cd976.js +1 -0
- package/dist/multi/416.app-bae2a0fe5738d77cd976.js +1 -0
- package/dist/multi/527.app-bae2a0fe5738d77cd976.js +1 -0
- package/dist/multi/600.app-bae2a0fe5738d77cd976.js +1 -0
- package/dist/multi/605.app-bae2a0fe5738d77cd976.js +1 -0
- package/dist/multi/638.app-bae2a0fe5738d77cd976.js +1 -0
- package/dist/multi/672.app-bae2a0fe5738d77cd976.js +1 -0
- package/dist/multi/686.app-bae2a0fe5738d77cd976.js +1 -0
- package/dist/multi/725.app-bae2a0fe5738d77cd976.js +1 -0
- package/dist/multi/741.app-bae2a0fe5738d77cd976.js +1 -0
- package/dist/multi/755.app-bae2a0fe5738d77cd976.js +1 -0
- package/dist/multi/894.app-bae2a0fe5738d77cd976.js +1 -0
- package/dist/multi/91.app-bae2a0fe5738d77cd976.js +1 -0
- package/dist/multi/943.app-bae2a0fe5738d77cd976.js +1 -0
- package/dist/multi/980.app-bae2a0fe5738d77cd976.js +1 -0
- package/dist/multi/app-bae2a0fe5738d77cd976.js +2 -0
- package/dist/multi/app-bae2a0fe5738d77cd976.js.LICENSE.txt +10 -0
- package/dist/multi/manifest.json +25 -24
- package/dist/multi/styles-bbf68b2ba63c38b53c38.css +48 -0
- package/dist/single/app-996d3b5869f8fc942b66.js +2 -0
- package/dist/single/app-996d3b5869f8fc942b66.js.LICENSE.txt +10 -0
- package/dist/single/manifest.json +1 -1
- package/package.json +31 -19
- package/src/assets/scss/day.scss +2 -0
- package/src/assets/scss/index.scss +1 -3
- package/src/assets/scss/night.scss +2 -0
- package/src/assets/scss/palette.scss +391 -391
- package/src/assets/scss/theme.scss +292 -79
- package/src/components/BaseLayout/index.tsx +10 -32
- package/src/components/BaseLayout/styles.scss +14 -4
- package/src/components/Charts/index.tsx +245 -0
- package/src/components/Charts/styles.scss +27 -0
- package/src/components/EnvironmentPicker/index.tsx +60 -0
- package/src/components/EnvironmentPicker/styles.scss +9 -0
- package/src/components/Footer/FooterLogo.tsx +1 -2
- package/src/components/Footer/FooterVersion.tsx +7 -3
- package/src/components/Footer/index.tsx +6 -2
- package/src/components/Header/CiInfo/index.tsx +67 -0
- package/src/components/Header/CiInfo/styles.scss +7 -0
- package/src/components/Header/index.tsx +21 -8
- package/src/components/Header/styles.scss +9 -1
- package/src/components/HeaderControls/index.tsx +20 -0
- package/src/components/MainReport/index.tsx +84 -6
- package/src/components/MainReport/styles.scss +20 -0
- package/src/components/Metadata/index.tsx +6 -4
- package/src/components/MetadataButton/index.tsx +14 -6
- package/src/components/MetadataButton/styles.scss +3 -0
- package/src/components/Modal/index.tsx +15 -167
- package/src/components/NavTabs/index.tsx +70 -0
- package/src/components/{TestResult/TestResultTabs → NavTabs}/styles.scss +0 -3
- package/src/components/Report/index.tsx +7 -0
- package/src/components/ReportBody/Filters.tsx +96 -64
- package/src/components/ReportBody/HeaderActions.tsx +2 -2
- package/src/components/ReportBody/SortBy.tsx +4 -7
- package/src/components/ReportBody/index.tsx +30 -24
- package/src/components/ReportBody/styles.scss +9 -3
- package/src/components/ReportGlobalAttachments/index.tsx +34 -0
- package/src/components/ReportGlobalAttachments/styles.scss +11 -0
- package/src/components/ReportGlobalErrors/index.tsx +30 -0
- package/src/components/ReportGlobalErrors/styles.scss +12 -0
- package/src/components/ReportHeader/ReportHeaderLogo.tsx +6 -2
- package/src/components/ReportHeader/ReportHeaderPie.tsx +1 -2
- package/src/components/ReportHeader/index.tsx +38 -12
- package/src/components/ReportHeader/styles.scss +9 -1
- package/src/components/ReportMetadata/MetadataSummary.tsx +57 -65
- package/src/components/ReportMetadata/MetadataWithIcon.tsx +11 -13
- package/src/components/ReportMetadata/index.tsx +50 -3
- package/src/components/ReportMetadata/styles.scss +0 -2
- package/src/components/ReportQualityGateResults/index.tsx +42 -0
- package/src/components/ReportQualityGateResults/styles.scss +44 -0
- package/src/components/ReportTabs/index.tsx +37 -0
- package/src/components/SectionPicker/index.tsx +55 -0
- package/src/components/SectionPicker/styles.scss +5 -0
- package/src/components/SectionSwitcher/index.tsx +16 -0
- package/src/components/SectionSwitcher/styles.scss +4 -0
- package/src/components/SectionTabs/index.tsx +0 -0
- package/src/components/SideBySide/index.tsx +52 -0
- package/src/components/SideBySide/styles.scss +64 -0
- package/src/components/SplitLayout/index.tsx +71 -0
- package/src/components/SplitLayout/styles.scss +84 -0
- package/src/components/TestResult/TestStepsEmpty/index.tsx +3 -9
- package/src/components/TestResult/TrAttachmentsView/index.tsx +29 -0
- package/src/components/TestResult/{TestResultDescription → TrDescription}/index.tsx +5 -5
- package/src/components/TestResult/{TestResultDropdown → TrDropdown}/index.tsx +7 -5
- package/src/components/TestResult/{TestResultEmpty → TrEmpty}/index.tsx +7 -13
- package/src/components/TestResult/TrEnvironmentItem/index.tsx +82 -0
- package/src/components/TestResult/TrEnvironmentItem/styles.scss +60 -0
- package/src/components/TestResult/TrEnvironmentsView/index.tsx +64 -0
- package/src/components/TestResult/TrEnvironmentsView/styles.scss +11 -0
- package/src/components/TestResult/TrError/TrDiff.tsx +121 -0
- package/src/components/TestResult/TrError/index.tsx +111 -0
- package/src/components/TestResult/TrError/styles.scss +223 -0
- package/src/components/TestResult/TrHeader/TrBreadcrumbs.tsx +44 -0
- package/src/components/TestResult/TrHeader/index.tsx +15 -0
- package/src/components/TestResult/{TestResultHeader → TrHeader}/styles.scss +7 -2
- package/src/components/TestResult/TrHistory/TrHistoryItem.tsx +94 -0
- package/src/components/TestResult/TrHistory/index.tsx +26 -0
- package/src/components/TestResult/{TestResultHistory → TrHistory}/styles.scss +2 -1
- package/src/components/TestResult/{TestResultInfo/TestResultInfoStatuses.tsx → TrInfo/TrInfoStatuses.tsx} +6 -4
- package/src/components/TestResult/TrInfo/index.tsx +99 -0
- package/src/components/TestResult/{TestResultInfo → TrInfo}/styles.scss +18 -0
- package/src/components/TestResult/{TestResultLinks → TrLinks}/index.tsx +8 -8
- package/src/components/TestResult/{TestResultMetadata → TrMetadata}/index.tsx +6 -6
- package/src/components/TestResult/{TestResultNavigation → TrNavigation}/index.tsx +7 -9
- package/src/components/TestResult/TrOverview.tsx +46 -0
- package/src/components/TestResult/{TestResultParameters → TrParameters}/index.tsx +4 -4
- package/src/components/TestResult/TrPrevStatuses/index.tsx +63 -0
- package/src/components/TestResult/TrPwTraces/PwTrace.tsx +34 -0
- package/src/components/TestResult/TrPwTraces/PwTraceButton.tsx +32 -0
- package/src/components/TestResult/TrPwTraces/index.tsx +32 -0
- package/src/components/TestResult/TrPwTraces/styles.scss +20 -0
- package/src/components/TestResult/TrRetriesView/TrRetriesItem.tsx +70 -0
- package/src/components/TestResult/TrRetriesView/index.tsx +29 -0
- package/src/components/TestResult/{TestResultSetup → TrSetup}/index.tsx +13 -13
- package/src/components/TestResult/{TestResultSeverity → TrSeverity}/index.tsx +2 -2
- package/src/components/TestResult/{TestResultStatus → TrStatus}/index.tsx +5 -5
- package/src/components/TestResult/TrSteps/TrAttachment.tsx +118 -0
- package/src/components/TestResult/{TestResultSteps/testResultAttachmentInfo.tsx → TrSteps/TrAttachmentInfo.tsx} +11 -11
- package/src/components/TestResult/TrSteps/TrStep.tsx +98 -0
- package/src/components/TestResult/TrSteps/TrStepInfo.tsx +90 -0
- package/src/components/TestResult/{TestResultSteps → TrSteps}/index.tsx +12 -12
- package/src/components/TestResult/{TestResultSteps → TrSteps}/styles.scss +49 -10
- package/src/components/TestResult/{TestResultSteps → TrSteps}/wrongAttachment.tsx +1 -1
- package/src/components/TestResult/TrTabs/index.tsx +42 -0
- package/src/components/TestResult/{TestResultTeardown → TrTeardown}/index.tsx +13 -13
- package/src/components/TestResult/index.tsx +54 -38
- package/src/components/TestResult/styles.scss +12 -0
- package/src/components/Timeline/index.tsx +100 -0
- package/src/components/Timeline/styles.scss +45 -0
- package/src/components/ToggleLayout/index.tsx +17 -0
- package/src/components/Tree/index.tsx +117 -11
- package/src/components/Tree/styles.scss +23 -5
- package/src/index.html +22 -6
- package/src/index.tsx +90 -20
- package/src/locales/az.json +378 -0
- package/src/locales/de.json +378 -0
- package/src/locales/en.json +378 -0
- package/src/locales/es.json +378 -0
- package/src/locales/fr.json +378 -0
- package/src/locales/he.json +378 -0
- package/src/locales/hy.json +378 -0
- package/src/locales/it.json +378 -0
- package/src/locales/ja.json +378 -0
- package/src/locales/ka.json +378 -0
- package/src/locales/kr.json +378 -0
- package/src/locales/nl.json +378 -0
- package/src/locales/pl.json +386 -0
- package/src/locales/pt.json +378 -0
- package/src/locales/ru.json +386 -0
- package/src/locales/sv.json +378 -0
- package/src/locales/tr.json +378 -0
- package/src/locales/ua.json +329 -0
- package/src/locales/zh.json +378 -0
- package/src/stores/chart.ts +41 -6
- package/src/stores/env.ts +88 -0
- package/src/stores/envInfo.ts +2 -2
- package/src/stores/globals.ts +28 -0
- package/src/stores/layout.ts +36 -0
- package/src/stores/locale.ts +77 -29
- package/src/stores/modal.ts +22 -0
- package/src/stores/qualityGate.ts +28 -0
- package/src/stores/router.ts +108 -0
- package/src/stores/sections.ts +63 -0
- package/src/stores/stats.ts +52 -7
- package/src/stores/testResults.ts +13 -9
- package/src/stores/theme.ts +15 -18
- package/src/stores/timeline.ts +39 -0
- package/src/stores/tree.ts +65 -110
- package/src/stores/treeFilters/actions.ts +67 -0
- package/src/stores/treeFilters/constants.ts +7 -0
- package/src/stores/treeFilters/index.ts +3 -0
- package/src/stores/treeFilters/store.ts +73 -0
- package/src/stores/treeFilters/types.ts +12 -0
- package/src/stores/variables.ts +40 -0
- package/src/styles.scss +66 -0
- package/src/utils/persist.ts +23 -0
- package/src/utils/time.ts +1 -0
- package/src/utils/tree.ts +30 -0
- package/src/utils/treeFilters.ts +42 -24
- package/test/components/Header/CiInfo.test.tsx +177 -0
- package/test/components/Header.test.tsx +122 -0
- package/test/stores/treeFilters.test.ts +302 -0
- package/test/utils/treeFilters.test.ts +189 -44
- package/tsconfig.json +7 -2
- package/tsconfig.node.json +8 -0
- package/types.d.ts +45 -24
- package/vitest.config.ts +15 -2
- package/vitest.setup.ts +1 -0
- package/webpack.config.js +35 -5
- package/dist/multi/141.app-f32e4213.js +0 -1
- package/dist/multi/222.app-f32e4213.js +0 -1
- package/dist/multi/335.app-f32e4213.js +0 -1
- package/dist/multi/34.app-f32e4213.js +0 -1
- package/dist/multi/349.app-f32e4213.js +0 -1
- package/dist/multi/378.app-f32e4213.js +0 -1
- package/dist/multi/406.app-f32e4213.js +0 -1
- package/dist/multi/476.app-f32e4213.js +0 -1
- package/dist/multi/53.app-f32e4213.js +0 -1
- package/dist/multi/584.app-f32e4213.js +0 -1
- package/dist/multi/690.app-f32e4213.js +0 -1
- package/dist/multi/747.app-f32e4213.js +0 -1
- package/dist/multi/767.app-f32e4213.js +0 -1
- package/dist/multi/816.app-f32e4213.js +0 -1
- package/dist/multi/83.app-f32e4213.js +0 -1
- package/dist/multi/873.app-f32e4213.js +0 -1
- package/dist/multi/920.app-f32e4213.js +0 -1
- package/dist/multi/991.app-f32e4213.js +0 -1
- package/dist/multi/app-f32e4213.js +0 -2
- package/dist/multi/app-f32e4213.js.LICENSE.txt +0 -16
- package/dist/multi/styles-f32e4213.css +0 -284
- package/dist/single/app-7fa8e43f.js +0 -2
- package/dist/single/app-7fa8e43f.js.LICENSE.txt +0 -16
- package/src/assets/scss/code.scss +0 -71
- package/src/assets/scss/typography.scss +0 -218
- package/src/components/ArrowButton/index.tsx +0 -36
- package/src/components/ArrowButton/styles.scss +0 -35
- package/src/components/LanguagePicker/index.tsx +0 -40
- package/src/components/Modal/styles.scss +0 -126
- package/src/components/ReportLogo/index.tsx +0 -16
- package/src/components/ReportLogo/styles.scss +0 -20
- package/src/components/ReportLogoFull/index.tsx +0 -20
- package/src/components/ReportLogoFull/styles.scss +0 -7
- package/src/components/Tabs/index.tsx +0 -62
- package/src/components/TestResult/TestResultAttachmentsView/index.tsx +0 -27
- package/src/components/TestResult/TestResultError/index.tsx +0 -59
- package/src/components/TestResult/TestResultError/styles.scss +0 -51
- package/src/components/TestResult/TestResultHeader/index.tsx +0 -55
- package/src/components/TestResult/TestResultHistory/TestResultHistoryItem.tsx +0 -67
- package/src/components/TestResult/TestResultHistory/index.tsx +0 -26
- package/src/components/TestResult/TestResultInfo/index.tsx +0 -79
- package/src/components/TestResult/TestResultOverview.tsx +0 -43
- package/src/components/TestResult/TestResultPrevStatuses/index.tsx +0 -49
- package/src/components/TestResult/TestResultRetriesView/TestResultRetriesItem.tsx +0 -52
- package/src/components/TestResult/TestResultRetriesView/index.tsx +0 -24
- package/src/components/TestResult/TestResultSteps/HtmlAttachmentPreview.tsx +0 -12
- package/src/components/TestResult/TestResultSteps/attachment.tsx +0 -68
- package/src/components/TestResult/TestResultSteps/attachmentCode.tsx +0 -20
- package/src/components/TestResult/TestResultSteps/attachmentImage.tsx +0 -32
- package/src/components/TestResult/TestResultSteps/attachmentVideo.tsx +0 -15
- package/src/components/TestResult/TestResultSteps/testResultAttachment.tsx +0 -77
- package/src/components/TestResult/TestResultSteps/testResultStep.tsx +0 -85
- package/src/components/TestResult/TestResultSteps/testResultStepInfo.tsx +0 -30
- package/src/components/TestResult/TestResultTabs/index.tsx +0 -59
- package/src/components/ThemeButton/ThemeButton.tsx +0 -20
- package/src/components/Tree/Tree.tsx +0 -75
- package/src/components/Tree/TreeHeader.tsx +0 -82
- package/src/components/Tree/TreeItem.tsx +0 -35
- package/src/components/Tree/TreeItemIcon.tsx +0 -32
- package/src/i18n/constants.ts +0 -124
- package/src/i18n/locales/am.json +0 -120
- package/src/i18n/locales/az.json +0 -120
- package/src/i18n/locales/de.json +0 -120
- package/src/i18n/locales/en.json +0 -121
- package/src/i18n/locales/es.json +0 -120
- package/src/i18n/locales/fr.json +0 -120
- package/src/i18n/locales/he.json +0 -120
- package/src/i18n/locales/it.json +0 -120
- package/src/i18n/locales/ja.json +0 -120
- package/src/i18n/locales/ka.json +0 -120
- package/src/i18n/locales/kr.json +0 -120
- package/src/i18n/locales/nl.json +0 -120
- package/src/i18n/locales/pl.json +0 -118
- package/src/i18n/locales/pt.json +0 -120
- package/src/i18n/locales/ru.json +0 -118
- package/src/i18n/locales/sv.json +0 -120
- package/src/i18n/locales/tr.json +0 -120
- package/src/i18n/locales/zh.json +0 -120
- package/src/utils/attachments.ts +0 -156
- package/src/utils/capitalize.ts +0 -6
- /package/dist/multi/{JetBrainsMono_vf-b9a9c326..woff → JetBrainsMono_vf.woff} +0 -0
- /package/dist/multi/{JetBrainsMono_vf-9e9649b6..woff2 → JetBrainsMono_vf.woff2} +0 -0
- /package/dist/multi/{pt-root-ui_vf-22fe60ca..woff → pt-root-ui_vf.woff} +0 -0
- /package/dist/multi/{pt-root-ui_vf-9d251e8b..woff2 → pt-root-ui_vf.woff2} +0 -0
- /package/src/components/{Tabs → ReportTabs}/styles.scss +0 -0
- /package/src/components/TestResult/{TestResultAttachmentsView → TrAttachmentsView}/styles.scss +0 -0
- /package/src/components/TestResult/{TestResultDescription → TrDescription}/styles.scss +0 -0
- /package/src/components/TestResult/{TestResultDropdown → TrDropdown}/styles.scss +0 -0
- /package/src/components/TestResult/{TestResultEmpty → TrEmpty}/styles.scss +0 -0
- /package/src/components/TestResult/{TestResultLinks → TrLinks}/styles.scss +0 -0
- /package/src/components/TestResult/{TestResultMetadata → TrMetadata}/styles.scss +0 -0
- /package/src/components/TestResult/{TestResultNavigation → TrNavigation}/styles.scss +0 -0
- /package/src/components/TestResult/{TestResultParameters → TrParameters}/styles.scss +0 -0
- /package/src/components/TestResult/{TestResultPrevStatuses → TrPrevStatuses}/styles.scss +0 -0
- /package/src/components/TestResult/{TestResultRetriesView → TrRetriesView}/styles.scss +0 -0
- /package/src/components/TestResult/{TestResultSeverity → TrSeverity}/styles.scss +0 -0
- /package/src/components/TestResult/{TestResultStatus → TrStatus}/styles.scss +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { describe, expect, it } from "vitest";
|
|
2
2
|
import { createRecursiveTree, filterLeaves } from "../../src/utils/treeFilters.js";
|
|
3
|
-
import type {
|
|
3
|
+
import type { AwesomeTestResult } from "../../types.js";
|
|
4
4
|
|
|
5
5
|
describe("utils > treeFilters", () => {
|
|
6
6
|
describe("filterLeaves", () => {
|
|
@@ -11,15 +11,15 @@ describe("utils > treeFilters", () => {
|
|
|
11
11
|
a1: {
|
|
12
12
|
name: "a1",
|
|
13
13
|
start: baseDate,
|
|
14
|
-
} as
|
|
14
|
+
} as AwesomeTestResult,
|
|
15
15
|
b2: {
|
|
16
16
|
name: "b2",
|
|
17
17
|
start: baseDate + 1000,
|
|
18
|
-
} as
|
|
18
|
+
} as AwesomeTestResult,
|
|
19
19
|
c3: {
|
|
20
20
|
name: "c3",
|
|
21
21
|
start: baseDate + 2000,
|
|
22
|
-
} as
|
|
22
|
+
} as AwesomeTestResult,
|
|
23
23
|
};
|
|
24
24
|
const result = filterLeaves(leaves, leavesById, {
|
|
25
25
|
query: "",
|
|
@@ -48,17 +48,17 @@ describe("utils > treeFilters", () => {
|
|
|
48
48
|
name: "a1",
|
|
49
49
|
status: "passed",
|
|
50
50
|
start: baseDate,
|
|
51
|
-
} as
|
|
51
|
+
} as AwesomeTestResult,
|
|
52
52
|
b2: {
|
|
53
53
|
name: "b2",
|
|
54
54
|
status: "failed",
|
|
55
55
|
start: baseDate + 1000,
|
|
56
|
-
} as
|
|
56
|
+
} as AwesomeTestResult,
|
|
57
57
|
c3: {
|
|
58
58
|
name: "c3",
|
|
59
59
|
status: "passed",
|
|
60
60
|
start: baseDate + 2000,
|
|
61
|
-
} as
|
|
61
|
+
} as AwesomeTestResult,
|
|
62
62
|
};
|
|
63
63
|
const result = filterLeaves(leaves, leavesById, {
|
|
64
64
|
query: "",
|
|
@@ -83,17 +83,17 @@ describe("utils > treeFilters", () => {
|
|
|
83
83
|
name: "a1",
|
|
84
84
|
start: baseDate,
|
|
85
85
|
flaky: true,
|
|
86
|
-
} as
|
|
86
|
+
} as AwesomeTestResult,
|
|
87
87
|
b2: {
|
|
88
88
|
name: "b2",
|
|
89
89
|
start: baseDate + 1000,
|
|
90
90
|
flaky: false,
|
|
91
|
-
} as
|
|
91
|
+
} as AwesomeTestResult,
|
|
92
92
|
c3: {
|
|
93
93
|
name: "c3",
|
|
94
94
|
start: baseDate + 2000,
|
|
95
95
|
flaky: true,
|
|
96
|
-
} as
|
|
96
|
+
} as AwesomeTestResult,
|
|
97
97
|
};
|
|
98
98
|
const result = filterLeaves(leaves, leavesById, {
|
|
99
99
|
query: "",
|
|
@@ -118,17 +118,17 @@ describe("utils > treeFilters", () => {
|
|
|
118
118
|
name: "a1",
|
|
119
119
|
start: baseDate,
|
|
120
120
|
retry: true,
|
|
121
|
-
} as
|
|
121
|
+
} as AwesomeTestResult,
|
|
122
122
|
b2: {
|
|
123
123
|
name: "b2",
|
|
124
124
|
start: baseDate + 1000,
|
|
125
125
|
retry: false,
|
|
126
|
-
} as
|
|
126
|
+
} as AwesomeTestResult,
|
|
127
127
|
c3: {
|
|
128
128
|
name: "c3",
|
|
129
129
|
start: baseDate + 2000,
|
|
130
130
|
retry: false,
|
|
131
|
-
} as
|
|
131
|
+
} as AwesomeTestResult,
|
|
132
132
|
};
|
|
133
133
|
const result = filterLeaves(leaves, leavesById, {
|
|
134
134
|
filter: {
|
|
@@ -139,21 +139,166 @@ describe("utils > treeFilters", () => {
|
|
|
139
139
|
expect(result).toEqual([expect.objectContaining({ name: "a1" })]);
|
|
140
140
|
});
|
|
141
141
|
|
|
142
|
+
it("filters leaves by name query", () => {
|
|
143
|
+
const leaves = ["a1", "b2", "c3"];
|
|
144
|
+
const leavesById = {
|
|
145
|
+
a1: {
|
|
146
|
+
name: "Login test",
|
|
147
|
+
nodeId: "id-001",
|
|
148
|
+
},
|
|
149
|
+
b2: {
|
|
150
|
+
name: "Logout test",
|
|
151
|
+
nodeId: "id-002",
|
|
152
|
+
},
|
|
153
|
+
c3: {
|
|
154
|
+
name: "Registration test",
|
|
155
|
+
nodeId: "id-003",
|
|
156
|
+
},
|
|
157
|
+
};
|
|
158
|
+
const result = filterLeaves(leaves, leavesById as any, {
|
|
159
|
+
query: "Login",
|
|
160
|
+
});
|
|
161
|
+
|
|
162
|
+
expect(result).toEqual([expect.objectContaining({ name: "Login test" })]);
|
|
163
|
+
});
|
|
164
|
+
|
|
165
|
+
it("filters leaves by nodeId query", () => {
|
|
166
|
+
const leaves = ["a1", "b2", "c3"];
|
|
167
|
+
const leavesById = {
|
|
168
|
+
a1: {
|
|
169
|
+
name: "Login test",
|
|
170
|
+
nodeId: "abc-123",
|
|
171
|
+
},
|
|
172
|
+
b2: {
|
|
173
|
+
name: "Logout test",
|
|
174
|
+
nodeId: "def-456",
|
|
175
|
+
},
|
|
176
|
+
c3: {
|
|
177
|
+
name: "Registration test",
|
|
178
|
+
nodeId: "ghi-789",
|
|
179
|
+
},
|
|
180
|
+
};
|
|
181
|
+
const result = filterLeaves(leaves, leavesById as any, {
|
|
182
|
+
query: "def-456",
|
|
183
|
+
});
|
|
184
|
+
|
|
185
|
+
expect(result).toEqual([expect.objectContaining({ name: "Logout test", nodeId: "def-456" })]);
|
|
186
|
+
});
|
|
187
|
+
|
|
188
|
+
it("does not match partial nodeId (exact match only)", () => {
|
|
189
|
+
const leaves = ["a1", "b2", "c3"];
|
|
190
|
+
const leavesById = {
|
|
191
|
+
a1: {
|
|
192
|
+
name: "Test 1",
|
|
193
|
+
nodeId: "feature-login-001",
|
|
194
|
+
},
|
|
195
|
+
b2: {
|
|
196
|
+
name: "Test 2",
|
|
197
|
+
nodeId: "feature-login-002",
|
|
198
|
+
},
|
|
199
|
+
c3: {
|
|
200
|
+
name: "Test 3",
|
|
201
|
+
nodeId: "feature-logout-001",
|
|
202
|
+
},
|
|
203
|
+
};
|
|
204
|
+
const result = filterLeaves(leaves, leavesById as any, {
|
|
205
|
+
query: "login",
|
|
206
|
+
});
|
|
207
|
+
|
|
208
|
+
// nodeId requires exact match, so no results by nodeId
|
|
209
|
+
expect(result).toEqual([]);
|
|
210
|
+
});
|
|
211
|
+
|
|
212
|
+
it("matches nodeId with exact query", () => {
|
|
213
|
+
const leaves = ["a1", "b2", "c3"];
|
|
214
|
+
const leavesById = {
|
|
215
|
+
a1: {
|
|
216
|
+
name: "Test 1",
|
|
217
|
+
nodeId: "feature-login-001",
|
|
218
|
+
},
|
|
219
|
+
b2: {
|
|
220
|
+
name: "Test 2",
|
|
221
|
+
nodeId: "feature-login-002",
|
|
222
|
+
},
|
|
223
|
+
c3: {
|
|
224
|
+
name: "Test 3",
|
|
225
|
+
nodeId: "feature-logout-001",
|
|
226
|
+
},
|
|
227
|
+
};
|
|
228
|
+
const result = filterLeaves(leaves, leavesById as any, {
|
|
229
|
+
query: "feature-login-001",
|
|
230
|
+
});
|
|
231
|
+
|
|
232
|
+
expect(result).toEqual([expect.objectContaining({ nodeId: "feature-login-001" })]);
|
|
233
|
+
});
|
|
234
|
+
|
|
235
|
+
it("filters leaves matching by name (partial) or nodeId (exact)", () => {
|
|
236
|
+
const leaves = ["a1", "b2", "c3"];
|
|
237
|
+
const leavesById = {
|
|
238
|
+
a1: {
|
|
239
|
+
name: "Search functionality",
|
|
240
|
+
nodeId: "test-001",
|
|
241
|
+
},
|
|
242
|
+
b2: {
|
|
243
|
+
name: "Login test",
|
|
244
|
+
nodeId: "search",
|
|
245
|
+
},
|
|
246
|
+
c3: {
|
|
247
|
+
name: "Logout test",
|
|
248
|
+
nodeId: "test-003",
|
|
249
|
+
},
|
|
250
|
+
};
|
|
251
|
+
const result = filterLeaves(leaves, leavesById as any, {
|
|
252
|
+
query: "search",
|
|
253
|
+
});
|
|
254
|
+
|
|
255
|
+
// Both results match: one by name (partial), one by nodeId (exact)
|
|
256
|
+
expect(result).toHaveLength(2);
|
|
257
|
+
expect(result).toEqual(
|
|
258
|
+
expect.arrayContaining([
|
|
259
|
+
expect.objectContaining({ name: "Search functionality" }),
|
|
260
|
+
expect.objectContaining({ nodeId: "search" }),
|
|
261
|
+
]),
|
|
262
|
+
);
|
|
263
|
+
});
|
|
264
|
+
|
|
265
|
+
it("filters leaves case-insensitively by name (partial) and nodeId (exact)", () => {
|
|
266
|
+
const leaves = ["a1", "b2"];
|
|
267
|
+
const leavesById = {
|
|
268
|
+
a1: {
|
|
269
|
+
name: "LOGIN Test",
|
|
270
|
+
nodeId: "id-001",
|
|
271
|
+
},
|
|
272
|
+
b2: {
|
|
273
|
+
name: "Other test",
|
|
274
|
+
nodeId: "login",
|
|
275
|
+
},
|
|
276
|
+
};
|
|
277
|
+
const result = filterLeaves(leaves, leavesById as any, {
|
|
278
|
+
query: "login",
|
|
279
|
+
});
|
|
280
|
+
|
|
281
|
+
expect(result).toEqual([
|
|
282
|
+
expect.objectContaining({ name: "LOGIN Test" }),
|
|
283
|
+
expect.objectContaining({ nodeId: "login" }),
|
|
284
|
+
]);
|
|
285
|
+
});
|
|
286
|
+
|
|
142
287
|
it("sorts leave by duration in ascending order", () => {
|
|
143
288
|
const leaves = ["a1", "b2", "c3"];
|
|
144
289
|
const leavesById = {
|
|
145
290
|
a1: {
|
|
146
291
|
name: "a1",
|
|
147
292
|
duration: 1000,
|
|
148
|
-
} as
|
|
293
|
+
} as AwesomeTestResult,
|
|
149
294
|
b2: {
|
|
150
295
|
name: "b2",
|
|
151
296
|
duration: 2000,
|
|
152
|
-
} as
|
|
297
|
+
} as AwesomeTestResult,
|
|
153
298
|
c3: {
|
|
154
299
|
name: "c3",
|
|
155
300
|
duration: 3000,
|
|
156
|
-
} as
|
|
301
|
+
} as AwesomeTestResult,
|
|
157
302
|
};
|
|
158
303
|
const result = filterLeaves(leaves, leavesById, {
|
|
159
304
|
direction: "asc",
|
|
@@ -173,15 +318,15 @@ describe("utils > treeFilters", () => {
|
|
|
173
318
|
a1: {
|
|
174
319
|
name: "a1",
|
|
175
320
|
duration: 1000,
|
|
176
|
-
} as
|
|
321
|
+
} as AwesomeTestResult,
|
|
177
322
|
b2: {
|
|
178
323
|
name: "b2",
|
|
179
324
|
duration: 2000,
|
|
180
|
-
} as
|
|
325
|
+
} as AwesomeTestResult,
|
|
181
326
|
c3: {
|
|
182
327
|
name: "c3",
|
|
183
328
|
duration: 3000,
|
|
184
|
-
} as
|
|
329
|
+
} as AwesomeTestResult,
|
|
185
330
|
};
|
|
186
331
|
const result = filterLeaves(leaves, leavesById, {
|
|
187
332
|
direction: "desc",
|
|
@@ -200,13 +345,13 @@ describe("utils > treeFilters", () => {
|
|
|
200
345
|
const leavesById = {
|
|
201
346
|
a1: {
|
|
202
347
|
name: "a1",
|
|
203
|
-
} as
|
|
348
|
+
} as AwesomeTestResult,
|
|
204
349
|
b2: {
|
|
205
350
|
name: "b2",
|
|
206
|
-
} as
|
|
351
|
+
} as AwesomeTestResult,
|
|
207
352
|
c3: {
|
|
208
353
|
name: "c3",
|
|
209
|
-
} as
|
|
354
|
+
} as AwesomeTestResult,
|
|
210
355
|
};
|
|
211
356
|
const result = filterLeaves(leaves, leavesById, {
|
|
212
357
|
direction: "asc",
|
|
@@ -225,13 +370,13 @@ describe("utils > treeFilters", () => {
|
|
|
225
370
|
const leavesById = {
|
|
226
371
|
a1: {
|
|
227
372
|
name: "a1",
|
|
228
|
-
} as
|
|
373
|
+
} as AwesomeTestResult,
|
|
229
374
|
b2: {
|
|
230
375
|
name: "b2",
|
|
231
|
-
} as
|
|
376
|
+
} as AwesomeTestResult,
|
|
232
377
|
c3: {
|
|
233
378
|
name: "c3",
|
|
234
|
-
} as
|
|
379
|
+
} as AwesomeTestResult,
|
|
235
380
|
};
|
|
236
381
|
const result = filterLeaves(leaves, leavesById, {
|
|
237
382
|
direction: "desc",
|
|
@@ -251,23 +396,23 @@ describe("utils > treeFilters", () => {
|
|
|
251
396
|
a1: {
|
|
252
397
|
name: "a1",
|
|
253
398
|
status: "passed",
|
|
254
|
-
} as
|
|
399
|
+
} as AwesomeTestResult,
|
|
255
400
|
b2: {
|
|
256
401
|
name: "b2",
|
|
257
402
|
status: "failed",
|
|
258
|
-
} as
|
|
403
|
+
} as AwesomeTestResult,
|
|
259
404
|
c3: {
|
|
260
405
|
name: "c3",
|
|
261
406
|
status: "broken",
|
|
262
|
-
} as
|
|
407
|
+
} as AwesomeTestResult,
|
|
263
408
|
d4: {
|
|
264
409
|
name: "d4",
|
|
265
410
|
status: "unknown",
|
|
266
|
-
} as
|
|
411
|
+
} as AwesomeTestResult,
|
|
267
412
|
e5: {
|
|
268
413
|
name: "e5",
|
|
269
414
|
status: "skipped",
|
|
270
|
-
} as
|
|
415
|
+
} as AwesomeTestResult,
|
|
271
416
|
};
|
|
272
417
|
const result = filterLeaves(leaves, leavesById, {
|
|
273
418
|
direction: "asc",
|
|
@@ -289,23 +434,23 @@ describe("utils > treeFilters", () => {
|
|
|
289
434
|
a1: {
|
|
290
435
|
name: "a1",
|
|
291
436
|
status: "passed",
|
|
292
|
-
} as
|
|
437
|
+
} as AwesomeTestResult,
|
|
293
438
|
b2: {
|
|
294
439
|
name: "b2",
|
|
295
440
|
status: "failed",
|
|
296
|
-
} as
|
|
441
|
+
} as AwesomeTestResult,
|
|
297
442
|
c3: {
|
|
298
443
|
name: "c3",
|
|
299
444
|
status: "broken",
|
|
300
|
-
} as
|
|
445
|
+
} as AwesomeTestResult,
|
|
301
446
|
d4: {
|
|
302
447
|
name: "d4",
|
|
303
448
|
status: "unknown",
|
|
304
|
-
} as
|
|
449
|
+
} as AwesomeTestResult,
|
|
305
450
|
e5: {
|
|
306
451
|
name: "e5",
|
|
307
452
|
status: "skipped",
|
|
308
|
-
} as
|
|
453
|
+
} as AwesomeTestResult,
|
|
309
454
|
};
|
|
310
455
|
const result = filterLeaves(leaves, leavesById, {
|
|
311
456
|
direction: "desc",
|
|
@@ -329,17 +474,17 @@ describe("utils > treeFilters", () => {
|
|
|
329
474
|
name: "a1",
|
|
330
475
|
start: baseDate + 2000,
|
|
331
476
|
groupOrder: 3,
|
|
332
|
-
} as
|
|
477
|
+
} as AwesomeTestResult,
|
|
333
478
|
b2: {
|
|
334
479
|
name: "b2",
|
|
335
480
|
start: baseDate + 1000,
|
|
336
481
|
groupOrder: 2,
|
|
337
|
-
} as
|
|
482
|
+
} as AwesomeTestResult,
|
|
338
483
|
c3: {
|
|
339
484
|
name: "c3",
|
|
340
485
|
start: baseDate,
|
|
341
486
|
groupOrder: 1,
|
|
342
|
-
} as
|
|
487
|
+
} as AwesomeTestResult,
|
|
343
488
|
};
|
|
344
489
|
const result = filterLeaves(leaves, leavesById, {
|
|
345
490
|
direction: "asc",
|
|
@@ -361,17 +506,17 @@ describe("utils > treeFilters", () => {
|
|
|
361
506
|
name: "a1",
|
|
362
507
|
start: baseDate + 2000,
|
|
363
508
|
groupOrder: 3,
|
|
364
|
-
} as
|
|
509
|
+
} as AwesomeTestResult,
|
|
365
510
|
b2: {
|
|
366
511
|
name: "b2",
|
|
367
512
|
start: baseDate + 1000,
|
|
368
513
|
groupOrder: 2,
|
|
369
|
-
} as
|
|
514
|
+
} as AwesomeTestResult,
|
|
370
515
|
c3: {
|
|
371
516
|
name: "c3",
|
|
372
517
|
start: baseDate,
|
|
373
518
|
groupOrder: 1,
|
|
374
|
-
} as
|
|
519
|
+
} as AwesomeTestResult,
|
|
375
520
|
};
|
|
376
521
|
const result = filterLeaves(leaves, leavesById, {
|
|
377
522
|
direction: "desc",
|
|
@@ -397,15 +542,15 @@ describe("utils > treeFilters", () => {
|
|
|
397
542
|
a1: {
|
|
398
543
|
name: "a1",
|
|
399
544
|
start: baseDate,
|
|
400
|
-
} as
|
|
545
|
+
} as AwesomeTestResult,
|
|
401
546
|
b2: {
|
|
402
547
|
name: "b2",
|
|
403
548
|
start: baseDate + 1000,
|
|
404
|
-
} as
|
|
549
|
+
} as AwesomeTestResult,
|
|
405
550
|
c3: {
|
|
406
551
|
name: "c3",
|
|
407
552
|
start: baseDate + 2000,
|
|
408
|
-
} as
|
|
553
|
+
} as AwesomeTestResult,
|
|
409
554
|
};
|
|
410
555
|
const groupsById = {
|
|
411
556
|
a1: {
|
package/tsconfig.json
CHANGED
|
@@ -17,11 +17,16 @@
|
|
|
17
17
|
"noImplicitAny": true,
|
|
18
18
|
"resolveJsonModule": true,
|
|
19
19
|
"esModuleInterop": true,
|
|
20
|
-
"lib": ["ES2019", "dom"],
|
|
20
|
+
"lib": ["ES2019", "dom", "dom.iterable"],
|
|
21
21
|
// node types should not be used in web-commons
|
|
22
22
|
"types": [],
|
|
23
23
|
"skipLibCheck": true
|
|
24
24
|
},
|
|
25
25
|
"include": ["src"],
|
|
26
|
-
"exclude": ["node_modules", "dist"]
|
|
26
|
+
"exclude": ["node_modules", "dist"],
|
|
27
|
+
"references": [
|
|
28
|
+
{
|
|
29
|
+
"path": "./tsconfig.node.json"
|
|
30
|
+
}
|
|
31
|
+
]
|
|
27
32
|
}
|
package/types.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type {
|
|
2
2
|
AttachmentTestStepResult,
|
|
3
|
+
CiDescriptor,
|
|
3
4
|
DefaultTreeGroup,
|
|
4
5
|
HistoryTestResult,
|
|
5
6
|
TestFixtureResult,
|
|
@@ -10,30 +11,38 @@ import type {
|
|
|
10
11
|
WithChildren,
|
|
11
12
|
} from "@allurereport/core-api";
|
|
12
13
|
|
|
13
|
-
export type
|
|
14
|
+
export type Layout = "base" | "split";
|
|
15
|
+
|
|
16
|
+
export type AwesomeReportOptions = {
|
|
17
|
+
allureVersion: string;
|
|
14
18
|
reportName?: string;
|
|
15
19
|
logo?: string;
|
|
16
|
-
theme?: "light" | "dark";
|
|
20
|
+
theme?: "light" | "dark" | "auto";
|
|
17
21
|
groupBy?: string[];
|
|
18
|
-
reportLanguage?: "en"
|
|
22
|
+
reportLanguage?: "en";
|
|
19
23
|
createdAt: number;
|
|
20
24
|
reportUuid: string;
|
|
25
|
+
layout?: Layout;
|
|
26
|
+
defaultSection?: string;
|
|
27
|
+
sections?: string[];
|
|
28
|
+
cacheKey: string;
|
|
29
|
+
ci?: CiDescriptor;
|
|
21
30
|
};
|
|
22
31
|
|
|
23
|
-
export type
|
|
32
|
+
export type AwesomeFixtureResult = Omit<
|
|
24
33
|
TestFixtureResult,
|
|
25
34
|
"testResultIds" | "start" | "stop" | "sourceMetadata" | "steps"
|
|
26
35
|
> & {
|
|
27
|
-
steps:
|
|
36
|
+
steps: AwesomeTestStepResult[];
|
|
28
37
|
};
|
|
29
38
|
|
|
30
|
-
export type
|
|
39
|
+
export type AwesomeStatus = TestStatus | "total";
|
|
31
40
|
|
|
32
|
-
export type
|
|
41
|
+
export type AwesomeTestStepResult = TestStepResult;
|
|
33
42
|
|
|
34
|
-
type
|
|
43
|
+
type AwesomeBreadcrumbItem = string[] | string[][];
|
|
35
44
|
|
|
36
|
-
export interface
|
|
45
|
+
export interface AwesomeCategory {
|
|
37
46
|
name: string;
|
|
38
47
|
description?: string;
|
|
39
48
|
descriptionHtml?: string;
|
|
@@ -42,7 +51,8 @@ export interface AllureAwesomeCategory {
|
|
|
42
51
|
matchedStatuses?: TestStatus[];
|
|
43
52
|
flaky?: boolean;
|
|
44
53
|
}
|
|
45
|
-
|
|
54
|
+
|
|
55
|
+
export type AwesomeTestResult = Omit<
|
|
46
56
|
TestResult,
|
|
47
57
|
| "runSelector"
|
|
48
58
|
| "sourceMetadata"
|
|
@@ -51,37 +61,48 @@ export type AllureAwesomeTestResult = Omit<
|
|
|
51
61
|
| "precondition"
|
|
52
62
|
| "preconditionHtml"
|
|
53
63
|
| "steps"
|
|
64
|
+
| "environment"
|
|
54
65
|
> & {
|
|
55
|
-
setup:
|
|
56
|
-
teardown:
|
|
57
|
-
steps:
|
|
66
|
+
setup: AwesomeFixtureResult[];
|
|
67
|
+
teardown: AwesomeFixtureResult[];
|
|
68
|
+
steps: AwesomeTestStepResult[];
|
|
58
69
|
history: HistoryTestResult[];
|
|
59
70
|
retries?: TestResult[];
|
|
71
|
+
retriesCount?: number;
|
|
60
72
|
groupedLabels: Record<string, string[]>;
|
|
61
73
|
attachments?: AttachmentTestStepResult[];
|
|
62
|
-
breadcrumbs:
|
|
74
|
+
breadcrumbs: AwesomeBreadcrumbItem[];
|
|
63
75
|
order?: number;
|
|
64
76
|
groupOrder?: number;
|
|
65
77
|
retry: boolean;
|
|
66
|
-
categories?:
|
|
78
|
+
categories?: AwesomeCategory[];
|
|
79
|
+
environment?: string | "default";
|
|
80
|
+
tooltips?: Record<string, string>;
|
|
67
81
|
};
|
|
68
82
|
|
|
69
|
-
export type
|
|
70
|
-
|
|
71
|
-
"duration" | "name" | "start" | "status" | "groupOrder" | "flaky" | "retry"
|
|
83
|
+
export type AwesomeTreeLeaf = Pick<
|
|
84
|
+
AwesomeTestResult,
|
|
85
|
+
"duration" | "name" | "start" | "status" | "groupOrder" | "flaky" | "transition" | "retry" | "retriesCount"
|
|
72
86
|
> & {
|
|
73
87
|
nodeId: string;
|
|
88
|
+
transitionTooltip?: string;
|
|
89
|
+
tooltips?: Record<string, string>;
|
|
74
90
|
};
|
|
75
91
|
|
|
76
|
-
export type
|
|
77
|
-
|
|
78
|
-
export type AllureAwesomeTree = TreeData<AllureAwesomeTreeLeaf, AllureAwesomeTreeGroup>;
|
|
92
|
+
export type AwesomeTreeGroup = WithChildren & DefaultTreeGroup & { nodeId: string };
|
|
79
93
|
|
|
94
|
+
export type AwesomeTree = TreeData<AwesomeTreeLeaf, AwesomeTreeGroup>;
|
|
80
95
|
/**
|
|
81
96
|
* Tree which contains tree leaves instead of their IDs and recursive trees structure instead of groups
|
|
82
97
|
*/
|
|
83
|
-
export type
|
|
98
|
+
export type AwesomeRecursiveTree = DefaultTreeGroup & {
|
|
84
99
|
nodeId: string;
|
|
85
|
-
leaves:
|
|
86
|
-
trees:
|
|
100
|
+
leaves: AwesomeTreeLeaf[];
|
|
101
|
+
trees: AwesomeRecursiveTree[];
|
|
102
|
+
};
|
|
103
|
+
|
|
104
|
+
// TODO: maybe it should call `TestCase` instead of Group
|
|
105
|
+
// TODO: add worst status
|
|
106
|
+
export type AwesomeTestResultGroup = Pick<AwesomeTestResult, "name" | "fullName" | "groupOrder"> & {
|
|
107
|
+
testResults: AwesomeTestResult[];
|
|
87
108
|
};
|
package/vitest.config.ts
CHANGED
|
@@ -1,12 +1,25 @@
|
|
|
1
1
|
import { createRequire } from "node:module";
|
|
2
2
|
import { defineConfig } from "vitest/config";
|
|
3
|
+
import { resolve } from "path";
|
|
4
|
+
import { preact } from "@preact/preset-vite";
|
|
3
5
|
|
|
4
6
|
const require = createRequire(import.meta.url);
|
|
5
7
|
|
|
6
8
|
export default defineConfig({
|
|
9
|
+
plugins: [preact()],
|
|
10
|
+
resolve: {
|
|
11
|
+
alias: {
|
|
12
|
+
"@": resolve(__dirname, "./src"),
|
|
13
|
+
},
|
|
14
|
+
},
|
|
7
15
|
test: {
|
|
8
|
-
|
|
9
|
-
|
|
16
|
+
environment: "jsdom",
|
|
17
|
+
include: ["./test/**/*.test.{ts,tsx}"],
|
|
18
|
+
globals: true,
|
|
19
|
+
setupFiles: [
|
|
20
|
+
require.resolve("allure-vitest/setup"),
|
|
21
|
+
"./vitest.setup.ts",
|
|
22
|
+
],
|
|
10
23
|
reporters: [
|
|
11
24
|
"default",
|
|
12
25
|
[
|
package/vitest.setup.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import "@testing-library/jest-dom/vitest";
|
package/webpack.config.js
CHANGED
|
@@ -1,26 +1,43 @@
|
|
|
1
|
+
import ForkTsCheckerPlugin from "fork-ts-checker-webpack-plugin";
|
|
1
2
|
import HtmlWebpackPlugin from "html-webpack-plugin";
|
|
2
3
|
import MiniCssExtractPlugin from "mini-css-extract-plugin";
|
|
3
4
|
import { dirname, join } from "node:path";
|
|
4
5
|
import { env } from "node:process";
|
|
5
6
|
import { fileURLToPath } from "node:url";
|
|
6
7
|
import SpriteLoaderPlugin from "svg-sprite-loader/plugin.js";
|
|
8
|
+
import TerserPlugin from "terser-webpack-plugin";
|
|
7
9
|
import webpack from "webpack";
|
|
8
10
|
import { WebpackManifestPlugin } from "webpack-manifest-plugin";
|
|
9
|
-
import ForkTsCheckerPlugin from "fork-ts-checker-webpack-plugin";
|
|
10
11
|
|
|
11
12
|
const { SINGLE_FILE_MODE } = env;
|
|
12
13
|
const baseDir = dirname(fileURLToPath(import.meta.url));
|
|
13
14
|
|
|
14
15
|
export default (env, argv) => {
|
|
15
16
|
const devMode = argv?.mode === "development";
|
|
17
|
+
/**
|
|
18
|
+
* @type {import("webpack").Configuration}
|
|
19
|
+
*/
|
|
16
20
|
const config = {
|
|
17
21
|
entry: "./src/index.tsx",
|
|
18
22
|
output: {
|
|
19
23
|
path: join(baseDir, SINGLE_FILE_MODE ? "dist/single" : "dist/multi"),
|
|
20
|
-
filename: devMode ? "app.js" : "app-[
|
|
21
|
-
assetModuleFilename:
|
|
24
|
+
filename: devMode ? "app.js" : "app-[fullhash].js",
|
|
25
|
+
assetModuleFilename: "[name][ext]",
|
|
26
|
+
},
|
|
27
|
+
devtool: devMode ? "eval-source-map" : false,
|
|
28
|
+
optimization: {
|
|
29
|
+
minimize: !devMode,
|
|
30
|
+
minimizer: [
|
|
31
|
+
new TerserPlugin({
|
|
32
|
+
terserOptions: {
|
|
33
|
+
compress: {
|
|
34
|
+
drop_console: false,
|
|
35
|
+
drop_debugger: false,
|
|
36
|
+
},
|
|
37
|
+
},
|
|
38
|
+
}),
|
|
39
|
+
],
|
|
22
40
|
},
|
|
23
|
-
devtool: devMode ? "inline-source-map" : false,
|
|
24
41
|
module: {
|
|
25
42
|
rules: [
|
|
26
43
|
{
|
|
@@ -74,7 +91,7 @@ export default (env, argv) => {
|
|
|
74
91
|
DEVELOPMENT: devMode,
|
|
75
92
|
}),
|
|
76
93
|
new MiniCssExtractPlugin({
|
|
77
|
-
filename: devMode ? "styles.css" : "styles-[
|
|
94
|
+
filename: devMode ? "styles.css" : "styles-[contenthash].css",
|
|
78
95
|
}),
|
|
79
96
|
new SpriteLoaderPlugin(),
|
|
80
97
|
new WebpackManifestPlugin({
|
|
@@ -90,8 +107,21 @@ export default (env, argv) => {
|
|
|
90
107
|
"react-dom": "@preact/compat",
|
|
91
108
|
},
|
|
92
109
|
},
|
|
110
|
+
externals: {
|
|
111
|
+
// Some packages use crypto from node:crypto, but webpack doesn't support it
|
|
112
|
+
// I think this does not end up in a bundle, so it is safe to do this
|
|
113
|
+
"node:crypto": "crypto",
|
|
114
|
+
},
|
|
93
115
|
};
|
|
94
116
|
|
|
117
|
+
if (devMode) {
|
|
118
|
+
// Get and use source maps from dependencies
|
|
119
|
+
config.module.rules.push({
|
|
120
|
+
test: /\.js$/i,
|
|
121
|
+
extractSourceMap: true,
|
|
122
|
+
});
|
|
123
|
+
}
|
|
124
|
+
|
|
95
125
|
if (SINGLE_FILE_MODE) {
|
|
96
126
|
config.plugins.push(
|
|
97
127
|
new webpack.optimize.LimitChunkCountPlugin({
|