Skip to content

Commit fee35d7

Browse files
committed
Update from CI
1 parent 1939dd7 commit fee35d7

File tree

1 file changed

+124
-75
lines changed

1 file changed

+124
-75
lines changed

index.js

+124-75
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,127 @@
11
/******/ (() => { // webpackBootstrap
22
/******/ var __webpack_modules__ = ({
33

4+
/***/ 4770:
5+
/***/ (function(__unused_webpack_module, exports, __nccwpck_require__) {
6+
7+
"use strict";
8+
9+
var __importDefault = (this && this.__importDefault) || function (mod) {
10+
return (mod && mod.__esModule) ? mod : { "default": mod };
11+
};
12+
Object.defineProperty(exports, "__esModule", ({ value: true }));
13+
exports.dashboardResults = exports.dashboardSummary = void 0;
14+
const escape_html_1 = __importDefault(__nccwpck_require__(695));
15+
const test_parser_1 = __nccwpck_require__(2393);
16+
const dashboardUrl = "https://svg.test-summary.com/dashboard.svg";
17+
const passIconUrl = "https://svg.test-summary.com/icon/pass.svg?s=12";
18+
const failIconUrl = "https://svg.test-summary.com/icon/fail.svg?s=12";
19+
const skipIconUrl = "https://svg.test-summary.com/icon/skip.svg?s=12";
20+
// not used: const noneIconUrl = 'https://svg.test-summary.com/icon/none.svg?s=12'
21+
const unnamedTestCase = "<no name>";
22+
const footer = `This test report was produced by the <a href="https://github.com/test-summary/action">test-summary action</a>.&nbsp; Made with ❤️ in Cambridge.`;
23+
function dashboardSummary(result) {
24+
const count = result.counts;
25+
let summary = "";
26+
if (count.passed > 0) {
27+
summary += `${count.passed} passed`;
28+
}
29+
if (count.failed > 0) {
30+
summary += `${summary ? ", " : ""}${count.failed} failed`;
31+
}
32+
if (count.skipped > 0) {
33+
summary += `${summary ? ", " : ""}${count.skipped} skipped`;
34+
}
35+
return `<img src="${dashboardUrl}?p=${count.passed}&f=${count.failed}&s=${count.skipped}" alt="${summary}">`;
36+
}
37+
exports.dashboardSummary = dashboardSummary;
38+
function dashboardResults(result, show) {
39+
let table = "<table>";
40+
let count = 0;
41+
table += `<tr><th align="left">${statusTitle(show)}:</th></tr>`;
42+
for (const suite of result.suites) {
43+
for (const testcase of suite.cases) {
44+
if (show !== 0 && (show & testcase.status) === 0) {
45+
continue;
46+
}
47+
table += "<tr><td>";
48+
const icon = statusIcon(testcase.status);
49+
if (icon) {
50+
table += icon;
51+
table += "&nbsp; ";
52+
}
53+
table += (0, escape_html_1.default)(testcase.name || unnamedTestCase);
54+
if (testcase.description) {
55+
table += ": ";
56+
table += (0, escape_html_1.default)(testcase.description);
57+
}
58+
if (testcase.details) {
59+
table += "<br/>\n";
60+
table += "<pre><code>";
61+
table += (0, escape_html_1.default)(testcase.details);
62+
table += "</code></pre>";
63+
}
64+
table += "</td></tr>\n";
65+
count++;
66+
}
67+
}
68+
table += `<tr><td><sub>${footer}</sub></td></tr>`;
69+
table += "</table>";
70+
if (count === 0) {
71+
return "";
72+
}
73+
return table;
74+
}
75+
exports.dashboardResults = dashboardResults;
76+
function statusTitle(status) {
77+
switch (status) {
78+
case test_parser_1.TestStatus.Fail:
79+
return "Test failures";
80+
case test_parser_1.TestStatus.Skip:
81+
return "Skipped tests";
82+
case test_parser_1.TestStatus.Pass:
83+
return "Passing tests";
84+
default:
85+
return "Test results";
86+
}
87+
}
88+
function statusIcon(status) {
89+
switch (status) {
90+
case test_parser_1.TestStatus.Pass:
91+
return `<img src="${passIconUrl}" alt="" />`;
92+
case test_parser_1.TestStatus.Fail:
93+
return `<img src="${failIconUrl}" alt="" />`;
94+
case test_parser_1.TestStatus.Skip:
95+
return `<img src="${skipIconUrl}" alt="" />`;
96+
default:
97+
return;
98+
}
99+
}
100+
101+
102+
/***/ }),
103+
104+
/***/ 695:
105+
/***/ ((__unused_webpack_module, exports) => {
106+
107+
"use strict";
108+
109+
Object.defineProperty(exports, "__esModule", ({ value: true }));
110+
const lookup = {
111+
"&": "&amp;",
112+
'"': "&quot;",
113+
"'": "&apos;",
114+
"<": "&lt;",
115+
">": "&gt;"
116+
};
117+
function escapeHTML(s) {
118+
return s.replace(/[&"'<>]/g, c => lookup[c]);
119+
}
120+
exports["default"] = escapeHTML;
121+
122+
123+
/***/ }),
124+
4125
/***/ 7637:
5126
/***/ (function(__unused_webpack_module, exports, __nccwpck_require__) {
6127

@@ -44,12 +165,7 @@ const util = __importStar(__nccwpck_require__(3837));
44165
const core = __importStar(__nccwpck_require__(2186));
45166
const glob = __importStar(__nccwpck_require__(8252));
46167
const test_parser_1 = __nccwpck_require__(2393);
47-
const dashboardUrl = 'https://svg.test-summary.com/dashboard.svg';
48-
const passIconUrl = 'https://svg.test-summary.com/icon/pass.svg?s=12';
49-
const failIconUrl = 'https://svg.test-summary.com/icon/fail.svg?s=12';
50-
const skipIconUrl = 'https://svg.test-summary.com/icon/skip.svg?s=12';
51-
const noneIconUrl = 'https://svg.test-summary.com/icon/none.svg?s=12';
52-
const footer = `This test report was produced by the <a href="https://github.com/test-summary/action">test-summary action</a>.&nbsp; Made with ❤️ in Cambridge.`;
168+
const dashboard_1 = __nccwpck_require__(4770);
53169
function run() {
54170
return __awaiter(this, void 0, void 0, function* () {
55171
try {
@@ -123,9 +239,9 @@ function run() {
123239
total.suites.push(...result.suites);
124240
}
125241
/* Create and write the output */
126-
let output = dashboardSummary(total);
242+
let output = (0, dashboard_1.dashboardSummary)(total);
127243
if (show) {
128-
output += dashboardResults(total, show);
244+
output += (0, dashboard_1.dashboardResults)(total, show);
129245
}
130246
if (outputFile === "-") {
131247
console.log(output);
@@ -152,73 +268,6 @@ function run() {
152268
}
153269
});
154270
}
155-
function dashboardSummary(result) {
156-
const count = result.counts;
157-
let summary = "";
158-
if (count.passed > 0) {
159-
summary += `${count.passed} passed`;
160-
}
161-
if (count.failed > 0) {
162-
summary += `${summary ? ', ' : ''}${count.failed} failed`;
163-
}
164-
if (count.skipped > 0) {
165-
summary += `${summary ? ', ' : ''}${count.skipped} skipped`;
166-
}
167-
return `<img src="${dashboardUrl}?p=${count.passed}&f=${count.failed}&s=${count.skipped}" alt="${summary}">`;
168-
}
169-
function dashboardResults(result, show) {
170-
let table = "<table>";
171-
let count = 0;
172-
let title;
173-
if (show == test_parser_1.TestStatus.Fail) {
174-
title = "Test failures";
175-
}
176-
else if (show === test_parser_1.TestStatus.Skip) {
177-
title = "Skipped tests";
178-
}
179-
else if (show === test_parser_1.TestStatus.Pass) {
180-
title = "Passing tests";
181-
}
182-
else {
183-
title = "Test results";
184-
}
185-
table += `<tr><th align="left">${title}:</th></tr>`;
186-
for (const suite of result.suites) {
187-
for (const testcase of suite.cases) {
188-
if (show != 0 && (show & testcase.status) == 0) {
189-
continue;
190-
}
191-
table += "<tr><td>";
192-
if (testcase.status == test_parser_1.TestStatus.Pass) {
193-
table += `<img src="${passIconUrl}" alt="">&nbsp; `;
194-
}
195-
else if (testcase.status == test_parser_1.TestStatus.Fail) {
196-
table += `<img src="${failIconUrl}" alt="">&nbsp; `;
197-
}
198-
else if (testcase.status == test_parser_1.TestStatus.Skip) {
199-
table += `<img src="${skipIconUrl}" alt="">&nbsp; `;
200-
}
201-
table += testcase.name;
202-
if (testcase.description) {
203-
table += ": ";
204-
table += testcase.description;
205-
}
206-
if (testcase.details) {
207-
table += "<br/><pre><code>";
208-
table += testcase.details;
209-
table += "</code></pre>";
210-
}
211-
table += "</td></tr>\n";
212-
count++;
213-
}
214-
}
215-
table += `<tr><td><sub>${footer}</sub></td></tr>`;
216-
table += "</table>";
217-
if (count == 0) {
218-
return "";
219-
}
220-
return table;
221-
}
222271
run();
223272

224273

0 commit comments

Comments
 (0)