@scifeon/sdk 0.100.0 → 0.102.0
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/action-target.d.ts +6 -6
- package/dist/action-target.js +10 -10
- package/dist/app/app-generator.d.ts +34 -34
- package/dist/app/app-generator.js +460 -460
- package/dist/app/app-persist.d.ts +18 -18
- package/dist/app/app-persist.js +193 -193
- package/dist/app/app-validator.d.ts +8 -8
- package/dist/app/app-validator.js +145 -145
- package/dist/app/interfaces/app-json.interface.d.ts +4 -4
- package/dist/app/interfaces/app-json.interface.js +2 -2
- package/dist/app/interfaces/app-type.enum.d.ts +5 -5
- package/dist/app/interfaces/app-type.enum.js +9 -9
- package/dist/app/interfaces/contributions/contributions-json.interface.d.ts +55 -55
- package/dist/app/interfaces/contributions/contributions-json.interface.js +2 -2
- package/dist/app/interfaces/contributions/main-menu.interface.d.ts +12 -12
- package/dist/app/interfaces/contributions/main-menu.interface.js +2 -2
- package/dist/app/interfaces/contributions/menu-item.interface.d.ts +5 -5
- package/dist/app/interfaces/contributions/menu-item.interface.js +2 -2
- package/dist/app/interfaces/contributions/page-menu-item.interface.d.ts +10 -10
- package/dist/app/interfaces/contributions/page-menu-item.interface.js +2 -2
- package/dist/app/interfaces/contributions/page-menu.interface.d.ts +9 -9
- package/dist/app/interfaces/contributions/page-menu.interface.js +2 -2
- package/dist/app/interfaces/package-json.interface.d.ts +14 -14
- package/dist/app/interfaces/package-json.interface.js +2 -2
- package/dist/app/interfaces/webpack-config.interface.d.ts +5 -5
- package/dist/app/interfaces/webpack-config.interface.js +2 -2
- package/dist/cli/commands/app/build.d.ts +4 -4
- package/dist/cli/commands/app/build.js +43 -43
- package/dist/cli/commands/app/clean.d.ts +3 -3
- package/dist/cli/commands/app/clean.js +15 -15
- package/dist/cli/commands/app/debug.d.ts +3 -3
- package/dist/cli/commands/app/debug.js +22 -22
- package/dist/cli/commands/app/e2e-test.d.ts +3 -3
- package/dist/cli/commands/app/e2e-test.js +23 -23
- package/dist/cli/commands/app/new.d.ts +6 -6
- package/dist/cli/commands/app/new.js +190 -190
- package/dist/cli/commands/app/package.d.ts +3 -3
- package/dist/cli/commands/app/package.js +10 -10
- package/dist/cli/commands/app/post-process.d.ts +8 -8
- package/dist/cli/commands/app/post-process.js +122 -122
- package/dist/cli/commands/app/scaffold.d.ts +4 -4
- package/dist/cli/commands/app/scaffold.js +19 -19
- package/dist/cli/commands/app/unit-test.d.ts +3 -3
- package/dist/cli/commands/app/unit-test.js +11 -11
- package/dist/cli/commands/app/validate.d.ts +3 -3
- package/dist/cli/commands/app/validate.js +20 -20
- package/dist/cli/commands/app/version.d.ts +3 -3
- package/dist/cli/commands/app/version.js +17 -17
- package/dist/cli/commands/app/watch.d.ts +3 -3
- package/dist/cli/commands/app/watch.js +48 -48
- package/dist/cli/commands/scifeon/download.d.ts +3 -3
- package/dist/cli/commands/scifeon/download.js +48 -48
- package/dist/cli/commands/scifeon/run.d.ts +3 -3
- package/dist/cli/commands/scifeon/run.js +41 -41
- package/dist/cli/config.d.ts +11 -11
- package/dist/cli/config.js +23 -23
- package/dist/cli/index.d.ts +9 -9
- package/dist/cli/index.js +159 -159
- package/dist/cli/webpack-runner.d.ts +1 -1
- package/dist/cli/webpack-runner.js +26 -26
- package/dist/download-utils.d.ts +3 -3
- package/dist/download-utils.js +50 -50
- package/dist/file-utils.d.ts +5 -5
- package/dist/file-utils.js +41 -41
- package/dist/html-report.d.ts +15 -15
- package/dist/html-report.js +212 -212
- package/dist/index.d.ts +2 -2
- package/dist/index.js +23 -23
- package/dist/logger.d.ts +14 -14
- package/dist/logger.js +52 -52
- package/dist/measurement-units.d.ts +5 -5
- package/dist/measurement-units.js +9 -9
- package/dist/page-types.d.ts +6 -6
- package/dist/page-types.js +10 -10
- package/dist/plugin-types.d.ts +43 -42
- package/dist/plugin-types.js +47 -46
- package/dist/unit-test-runner.d.ts +1 -1
- package/dist/unit-test-runner.js +82 -82
- package/dist/utils/test-helper.d.ts +4 -4
- package/dist/utils/test-helper.js +46 -46
- package/dist/webpack-app-config.d.ts +2 -2
- package/dist/webpack-app-config.js +248 -248
- package/dist/webpack-utils.d.ts +8 -8
- package/dist/webpack-utils.js +91 -91
- package/package.json +72 -72
- package/resources/new-app/README.md +12 -12
- package/resources/new-app/editor/.vscode/launch.json +40 -40
- package/resources/new-app/gitignore.txt +6 -6
- package/resources/new-app/typescript/src/index.html +14 -14
- package/resources/new-app/typescript/src/index.ts +32 -32
- package/resources/new-app/typescript/test/e2e/frontpage.test.ts +16 -16
- package/resources/new-app/typescript/test/e2e-config.ts +14 -14
- package/resources/new-app/typescript/test/unit/index.test.ts +7 -7
- package/resources/new-app/typescript/tsconfig.json +39 -39
- package/resources/scaffold-templates/scaffold-e2e-test.ts +19 -19
- package/resources/test/chai.js +10706 -10706
- package/resources/test/mocha.css +326 -326
- package/resources/test/mocha.js +16590 -16590
- package/resources/test/tests.html +26 -26
package/dist/html-report.js
CHANGED
|
@@ -1,212 +1,212 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.HtmlReport = void 0;
|
|
4
|
-
const fs = require("fs");
|
|
5
|
-
const path = require("path");
|
|
6
|
-
const logger_1 = require("./logger");
|
|
7
|
-
class HtmlReport {
|
|
8
|
-
constructor(reportsPath, appPath) {
|
|
9
|
-
this.reportsPath = reportsPath;
|
|
10
|
-
this.appPath = appPath;
|
|
11
|
-
this.stats = {
|
|
12
|
-
passed: 0,
|
|
13
|
-
total: 0,
|
|
14
|
-
failed: 0,
|
|
15
|
-
};
|
|
16
|
-
this.rootSuite = `
|
|
17
|
-
<table class="table suite">
|
|
18
|
-
<tr>
|
|
19
|
-
<td><h3>{title}</h3></td>
|
|
20
|
-
</tr>
|
|
21
|
-
<tr><td><ul>{tests}</ul></td></tr>
|
|
22
|
-
</table>`;
|
|
23
|
-
this.reportHtml = `<html>
|
|
24
|
-
<head>
|
|
25
|
-
<title>{title}</title>
|
|
26
|
-
<link rel="stylesheet" href="https://unpkg.com/spectre.css/dist/spectre.min.css">
|
|
27
|
-
<link rel="stylesheet" href="https://unpkg.com/spectre.css/dist/spectre-exp.min.css">
|
|
28
|
-
<link rel="stylesheet" href="https://unpkg.com/spectre.css/dist/spectre-icons.min.css">
|
|
29
|
-
<style>
|
|
30
|
-
html, table { font-size: 12px; }
|
|
31
|
-
span.small { font-size: 10px; }
|
|
32
|
-
ul, ul ul { list-style: none; }
|
|
33
|
-
table td.state { width: 25px; }
|
|
34
|
-
table td.duration { width: 60px; }
|
|
35
|
-
table.suite {
|
|
36
|
-
border-top: 3px solid #e7e9ed;
|
|
37
|
-
}
|
|
38
|
-
body { color: black; }
|
|
39
|
-
</style>
|
|
40
|
-
</head>
|
|
41
|
-
<body>
|
|
42
|
-
<h1> {title}</h1>
|
|
43
|
-
<table class="metadata table">
|
|
44
|
-
<tr>
|
|
45
|
-
<th style="width:15%">App:</th>
|
|
46
|
-
<td style="width:35%">{appVersion}</td>
|
|
47
|
-
<th style="width:15%">Total tests:</th>
|
|
48
|
-
<td style="width:35%">{totalTests}</td>
|
|
49
|
-
</tr>
|
|
50
|
-
<tr>
|
|
51
|
-
<th>Executed:</th>
|
|
52
|
-
<td>{timestamp}</td>
|
|
53
|
-
<th>Passed:</th>
|
|
54
|
-
<td><i class="text-success icon icon-check"></i> {passedTests}</td>
|
|
55
|
-
</tr>
|
|
56
|
-
<tr>
|
|
57
|
-
<th>Duration:</th>
|
|
58
|
-
<td>{duration}</td>
|
|
59
|
-
<th>Failed:</th>
|
|
60
|
-
<td><i class="text-error icon icon-cross"></i> {failedTests}</td>
|
|
61
|
-
</tr>
|
|
62
|
-
<tr>
|
|
63
|
-
<th></th>
|
|
64
|
-
<td></td>
|
|
65
|
-
<th>Skipped:</th>
|
|
66
|
-
<td><i class="text-warning icon icon-minus"></i> {missedTests}</td>
|
|
67
|
-
</tr>
|
|
68
|
-
<tr>
|
|
69
|
-
<td colspan="4" style="border:0;"></td>
|
|
70
|
-
</tr>
|
|
71
|
-
<tr>
|
|
72
|
-
<td colspan="4" style="border:0;">
|
|
73
|
-
<h3>Signature</h3>
|
|
74
|
-
<p>My signature indicates that all tests have "Passed", and the "Skipped" tests are manual tests or there is stated a reason for why a skipped test is skipped.</p>
|
|
75
|
-
</td>
|
|
76
|
-
</tr>
|
|
77
|
-
<tr>
|
|
78
|
-
<td style="border:0;">Operator:</td>
|
|
79
|
-
<td style="border:0;">______________________________________________</td>
|
|
80
|
-
<td style="border:0;">Date:</td>
|
|
81
|
-
<td style="border:0;">______________________________________________</td>
|
|
82
|
-
</tr>
|
|
83
|
-
<tr>
|
|
84
|
-
<td style="border:0;"></td>
|
|
85
|
-
<td style="border:0;"></td>
|
|
86
|
-
<td style="border:0;height:80px;">Signature:</td>
|
|
87
|
-
<td style="border:0;">______________________________________________</td>
|
|
88
|
-
</tr>
|
|
89
|
-
<tr>
|
|
90
|
-
<td style="border:0;">Reviewer:</td>
|
|
91
|
-
<td style="border:0;">______________________________________________</td>
|
|
92
|
-
<td style="border:0;">Date:</td>
|
|
93
|
-
<td style="border:0;">______________________________________________</td>
|
|
94
|
-
</tr>
|
|
95
|
-
<tr>
|
|
96
|
-
<td style="border:0;"></td>
|
|
97
|
-
<td style="border:0;"></td>
|
|
98
|
-
<td style="border:0;height:80px;">Signature:</td>
|
|
99
|
-
<td style="border:0;">______________________________________________</td>
|
|
100
|
-
</tr>
|
|
101
|
-
</table>
|
|
102
|
-
{tests}
|
|
103
|
-
</body>
|
|
104
|
-
</html>`;
|
|
105
|
-
}
|
|
106
|
-
generate(runner) {
|
|
107
|
-
this.grep = runner._grep;
|
|
108
|
-
const title = "Unit Test Report - Scifeon";
|
|
109
|
-
const reportFileName = "Unit_Test_Report_Scifeon.html";
|
|
110
|
-
logger_1.LOGGER.info("Generating HTML report: " + reportFileName);
|
|
111
|
-
const app = JSON.parse(fs.readFileSync(path.resolve(this.appPath, "package.json")).toString());
|
|
112
|
-
const html = this.reportHtml
|
|
113
|
-
.replace("{tests}", this.generateTestsHtml(runner))
|
|
114
|
-
.replace(/\{title\}/g, title)
|
|
115
|
-
.replace("{totalTests}", "" + this.stats.total)
|
|
116
|
-
.replace("{passedTests}", "" + this.stats.passed)
|
|
117
|
-
.replace("{failedTests}", "" + this.stats.failed)
|
|
118
|
-
.replace("{missedTests}", "" + (this.stats.total - this.stats.failed - this.stats.passed))
|
|
119
|
-
.replace("{appVersion}", app.namespace + "." + app.name + ": " + app.version)
|
|
120
|
-
.replace("{timestamp}", runner.stats.start.toISOString() + " -> " + runner.stats.end.toISOString())
|
|
121
|
-
.replace("{duration}", this.msToMinutesAndSeconds(runner.stats.duration));
|
|
122
|
-
fs.writeFileSync(path.resolve(this.reportsPath, reportFileName), html);
|
|
123
|
-
}
|
|
124
|
-
generateTestsHtml(runner) {
|
|
125
|
-
return this.generateSuites(runner.suite.suites, true);
|
|
126
|
-
}
|
|
127
|
-
generateSuite(suite, root) {
|
|
128
|
-
let html = "";
|
|
129
|
-
const testsHtml = this.generateTests(suite.tests, suite._beforeAll, suite._afterAll);
|
|
130
|
-
const suitesHtml = this.generateSuites(suite.suites);
|
|
131
|
-
if (root) {
|
|
132
|
-
html = this.rootSuite.replace("{title}", suite.title).replace("{filename}", suite.file.replace(__dirname, "")).replace("{tests}", suitesHtml + testsHtml);
|
|
133
|
-
}
|
|
134
|
-
else if (testsHtml !== null) {
|
|
135
|
-
html = `<li><b>${suite.title}</b>`;
|
|
136
|
-
if (suitesHtml) {
|
|
137
|
-
html += `<ul>${suitesHtml}</ul>`;
|
|
138
|
-
}
|
|
139
|
-
if (testsHtml) {
|
|
140
|
-
html += `${testsHtml}`;
|
|
141
|
-
}
|
|
142
|
-
html += "</li>";
|
|
143
|
-
}
|
|
144
|
-
return html;
|
|
145
|
-
}
|
|
146
|
-
generateTests(tests, beforeAll, afterAll) {
|
|
147
|
-
if (!tests.length && !beforeAll.length) {
|
|
148
|
-
return "";
|
|
149
|
-
}
|
|
150
|
-
let html = '<table class="table">';
|
|
151
|
-
if (beforeAll.length && beforeAll.some((ba) => ba.err)) {
|
|
152
|
-
html += '<tr><td class="state"><i class="text-error icon icon-cross"></i></td><td colspan="2">';
|
|
153
|
-
for (const ba of beforeAll.filter((b) => b.err)) {
|
|
154
|
-
html += ba.title + ' failed: <br/><span class="text-error">' + ba.err.name + ": " + ba.err.message + "<br/>" + ba.err.stack + "</span>";
|
|
155
|
-
}
|
|
156
|
-
html += "</td></tr>";
|
|
157
|
-
}
|
|
158
|
-
this.stats.total += tests.length;
|
|
159
|
-
for (const test of tests) {
|
|
160
|
-
html += `<tr><td class="state">`;
|
|
161
|
-
if (test.state === "passed") {
|
|
162
|
-
html += '<i class="text-success icon icon-check"></i>';
|
|
163
|
-
this.stats.passed++;
|
|
164
|
-
}
|
|
165
|
-
else if (test.state === "failed") {
|
|
166
|
-
html += '<i class="text-error icon icon-cross"></i>';
|
|
167
|
-
this.stats.failed++;
|
|
168
|
-
}
|
|
169
|
-
else {
|
|
170
|
-
html += '<i class="text-warning icon icon-minus"></i>';
|
|
171
|
-
}
|
|
172
|
-
html += `</td><td>${test.title}`;
|
|
173
|
-
if (test.err) {
|
|
174
|
-
html += `<br/><span class="text-error">${test.err.name}: ${test.err.message}</span>`;
|
|
175
|
-
}
|
|
176
|
-
html += `</td>
|
|
177
|
-
<td class="duration">${test.duration ? this.msToMinutesAndSeconds(test.duration) : "-"}</td>
|
|
178
|
-
</tr>`;
|
|
179
|
-
}
|
|
180
|
-
if (afterAll.length && afterAll.some((aa) => aa.err)) {
|
|
181
|
-
html += '<tr><td class="state"><i class="text-error icon icon-cross"></i></td><td colspan="2">';
|
|
182
|
-
for (const aa of afterAll.filter((a) => a.err)) {
|
|
183
|
-
html += aa.title + ' failed: <br/><span class="text-error">' + aa.err.name + ": " + aa.err.message + "<br/>" + aa.err.stack + "</span>";
|
|
184
|
-
}
|
|
185
|
-
html += "</td></tr>";
|
|
186
|
-
}
|
|
187
|
-
html += "</table>";
|
|
188
|
-
return html;
|
|
189
|
-
}
|
|
190
|
-
generateSuites(suites, root = false) {
|
|
191
|
-
let html = "";
|
|
192
|
-
if (this.grep && root) {
|
|
193
|
-
suites = suites.filter((s) => this.grep.test(s.title));
|
|
194
|
-
}
|
|
195
|
-
for (const suite of suites) {
|
|
196
|
-
html += this.generateSuite(suite, root);
|
|
197
|
-
}
|
|
198
|
-
return html;
|
|
199
|
-
}
|
|
200
|
-
msToMinutesAndSeconds(ms) {
|
|
201
|
-
if (ms < 1000) {
|
|
202
|
-
return ms + "ms";
|
|
203
|
-
}
|
|
204
|
-
if (ms < 60000) {
|
|
205
|
-
return (ms / 1000) + "s";
|
|
206
|
-
}
|
|
207
|
-
ms = 1000 * Math.round(ms / 1000);
|
|
208
|
-
const d = new Date(ms);
|
|
209
|
-
return d.getUTCMinutes() + ":" + d.getUTCSeconds() + "m";
|
|
210
|
-
}
|
|
211
|
-
}
|
|
212
|
-
exports.HtmlReport = HtmlReport;
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.HtmlReport = void 0;
|
|
4
|
+
const fs = require("fs");
|
|
5
|
+
const path = require("path");
|
|
6
|
+
const logger_1 = require("./logger");
|
|
7
|
+
class HtmlReport {
|
|
8
|
+
constructor(reportsPath, appPath) {
|
|
9
|
+
this.reportsPath = reportsPath;
|
|
10
|
+
this.appPath = appPath;
|
|
11
|
+
this.stats = {
|
|
12
|
+
passed: 0,
|
|
13
|
+
total: 0,
|
|
14
|
+
failed: 0,
|
|
15
|
+
};
|
|
16
|
+
this.rootSuite = `
|
|
17
|
+
<table class="table suite">
|
|
18
|
+
<tr>
|
|
19
|
+
<td><h3>{title}</h3></td>
|
|
20
|
+
</tr>
|
|
21
|
+
<tr><td><ul>{tests}</ul></td></tr>
|
|
22
|
+
</table>`;
|
|
23
|
+
this.reportHtml = `<html>
|
|
24
|
+
<head>
|
|
25
|
+
<title>{title}</title>
|
|
26
|
+
<link rel="stylesheet" href="https://unpkg.com/spectre.css/dist/spectre.min.css">
|
|
27
|
+
<link rel="stylesheet" href="https://unpkg.com/spectre.css/dist/spectre-exp.min.css">
|
|
28
|
+
<link rel="stylesheet" href="https://unpkg.com/spectre.css/dist/spectre-icons.min.css">
|
|
29
|
+
<style>
|
|
30
|
+
html, table { font-size: 12px; }
|
|
31
|
+
span.small { font-size: 10px; }
|
|
32
|
+
ul, ul ul { list-style: none; }
|
|
33
|
+
table td.state { width: 25px; }
|
|
34
|
+
table td.duration { width: 60px; }
|
|
35
|
+
table.suite {
|
|
36
|
+
border-top: 3px solid #e7e9ed;
|
|
37
|
+
}
|
|
38
|
+
body { color: black; }
|
|
39
|
+
</style>
|
|
40
|
+
</head>
|
|
41
|
+
<body>
|
|
42
|
+
<h1> {title}</h1>
|
|
43
|
+
<table class="metadata table">
|
|
44
|
+
<tr>
|
|
45
|
+
<th style="width:15%">App:</th>
|
|
46
|
+
<td style="width:35%">{appVersion}</td>
|
|
47
|
+
<th style="width:15%">Total tests:</th>
|
|
48
|
+
<td style="width:35%">{totalTests}</td>
|
|
49
|
+
</tr>
|
|
50
|
+
<tr>
|
|
51
|
+
<th>Executed:</th>
|
|
52
|
+
<td>{timestamp}</td>
|
|
53
|
+
<th>Passed:</th>
|
|
54
|
+
<td><i class="text-success icon icon-check"></i> {passedTests}</td>
|
|
55
|
+
</tr>
|
|
56
|
+
<tr>
|
|
57
|
+
<th>Duration:</th>
|
|
58
|
+
<td>{duration}</td>
|
|
59
|
+
<th>Failed:</th>
|
|
60
|
+
<td><i class="text-error icon icon-cross"></i> {failedTests}</td>
|
|
61
|
+
</tr>
|
|
62
|
+
<tr>
|
|
63
|
+
<th></th>
|
|
64
|
+
<td></td>
|
|
65
|
+
<th>Skipped:</th>
|
|
66
|
+
<td><i class="text-warning icon icon-minus"></i> {missedTests}</td>
|
|
67
|
+
</tr>
|
|
68
|
+
<tr>
|
|
69
|
+
<td colspan="4" style="border:0;"></td>
|
|
70
|
+
</tr>
|
|
71
|
+
<tr>
|
|
72
|
+
<td colspan="4" style="border:0;">
|
|
73
|
+
<h3>Signature</h3>
|
|
74
|
+
<p>My signature indicates that all tests have "Passed", and the "Skipped" tests are manual tests or there is stated a reason for why a skipped test is skipped.</p>
|
|
75
|
+
</td>
|
|
76
|
+
</tr>
|
|
77
|
+
<tr>
|
|
78
|
+
<td style="border:0;">Operator:</td>
|
|
79
|
+
<td style="border:0;">______________________________________________</td>
|
|
80
|
+
<td style="border:0;">Date:</td>
|
|
81
|
+
<td style="border:0;">______________________________________________</td>
|
|
82
|
+
</tr>
|
|
83
|
+
<tr>
|
|
84
|
+
<td style="border:0;"></td>
|
|
85
|
+
<td style="border:0;"></td>
|
|
86
|
+
<td style="border:0;height:80px;">Signature:</td>
|
|
87
|
+
<td style="border:0;">______________________________________________</td>
|
|
88
|
+
</tr>
|
|
89
|
+
<tr>
|
|
90
|
+
<td style="border:0;">Reviewer:</td>
|
|
91
|
+
<td style="border:0;">______________________________________________</td>
|
|
92
|
+
<td style="border:0;">Date:</td>
|
|
93
|
+
<td style="border:0;">______________________________________________</td>
|
|
94
|
+
</tr>
|
|
95
|
+
<tr>
|
|
96
|
+
<td style="border:0;"></td>
|
|
97
|
+
<td style="border:0;"></td>
|
|
98
|
+
<td style="border:0;height:80px;">Signature:</td>
|
|
99
|
+
<td style="border:0;">______________________________________________</td>
|
|
100
|
+
</tr>
|
|
101
|
+
</table>
|
|
102
|
+
{tests}
|
|
103
|
+
</body>
|
|
104
|
+
</html>`;
|
|
105
|
+
}
|
|
106
|
+
generate(runner) {
|
|
107
|
+
this.grep = runner._grep;
|
|
108
|
+
const title = "Unit Test Report - Scifeon";
|
|
109
|
+
const reportFileName = "Unit_Test_Report_Scifeon.html";
|
|
110
|
+
logger_1.LOGGER.info("Generating HTML report: " + reportFileName);
|
|
111
|
+
const app = JSON.parse(fs.readFileSync(path.resolve(this.appPath, "package.json")).toString());
|
|
112
|
+
const html = this.reportHtml
|
|
113
|
+
.replace("{tests}", this.generateTestsHtml(runner))
|
|
114
|
+
.replace(/\{title\}/g, title)
|
|
115
|
+
.replace("{totalTests}", "" + this.stats.total)
|
|
116
|
+
.replace("{passedTests}", "" + this.stats.passed)
|
|
117
|
+
.replace("{failedTests}", "" + this.stats.failed)
|
|
118
|
+
.replace("{missedTests}", "" + (this.stats.total - this.stats.failed - this.stats.passed))
|
|
119
|
+
.replace("{appVersion}", app.namespace + "." + app.name + ": " + app.version)
|
|
120
|
+
.replace("{timestamp}", runner.stats.start.toISOString() + " -> " + runner.stats.end.toISOString())
|
|
121
|
+
.replace("{duration}", this.msToMinutesAndSeconds(runner.stats.duration));
|
|
122
|
+
fs.writeFileSync(path.resolve(this.reportsPath, reportFileName), html);
|
|
123
|
+
}
|
|
124
|
+
generateTestsHtml(runner) {
|
|
125
|
+
return this.generateSuites(runner.suite.suites, true);
|
|
126
|
+
}
|
|
127
|
+
generateSuite(suite, root) {
|
|
128
|
+
let html = "";
|
|
129
|
+
const testsHtml = this.generateTests(suite.tests, suite._beforeAll, suite._afterAll);
|
|
130
|
+
const suitesHtml = this.generateSuites(suite.suites);
|
|
131
|
+
if (root) {
|
|
132
|
+
html = this.rootSuite.replace("{title}", suite.title).replace("{filename}", suite.file.replace(__dirname, "")).replace("{tests}", suitesHtml + testsHtml);
|
|
133
|
+
}
|
|
134
|
+
else if (testsHtml !== null) {
|
|
135
|
+
html = `<li><b>${suite.title}</b>`;
|
|
136
|
+
if (suitesHtml) {
|
|
137
|
+
html += `<ul>${suitesHtml}</ul>`;
|
|
138
|
+
}
|
|
139
|
+
if (testsHtml) {
|
|
140
|
+
html += `${testsHtml}`;
|
|
141
|
+
}
|
|
142
|
+
html += "</li>";
|
|
143
|
+
}
|
|
144
|
+
return html;
|
|
145
|
+
}
|
|
146
|
+
generateTests(tests, beforeAll, afterAll) {
|
|
147
|
+
if (!tests.length && !beforeAll.length) {
|
|
148
|
+
return "";
|
|
149
|
+
}
|
|
150
|
+
let html = '<table class="table">';
|
|
151
|
+
if (beforeAll.length && beforeAll.some((ba) => ba.err)) {
|
|
152
|
+
html += '<tr><td class="state"><i class="text-error icon icon-cross"></i></td><td colspan="2">';
|
|
153
|
+
for (const ba of beforeAll.filter((b) => b.err)) {
|
|
154
|
+
html += ba.title + ' failed: <br/><span class="text-error">' + ba.err.name + ": " + ba.err.message + "<br/>" + ba.err.stack + "</span>";
|
|
155
|
+
}
|
|
156
|
+
html += "</td></tr>";
|
|
157
|
+
}
|
|
158
|
+
this.stats.total += tests.length;
|
|
159
|
+
for (const test of tests) {
|
|
160
|
+
html += `<tr><td class="state">`;
|
|
161
|
+
if (test.state === "passed") {
|
|
162
|
+
html += '<i class="text-success icon icon-check"></i>';
|
|
163
|
+
this.stats.passed++;
|
|
164
|
+
}
|
|
165
|
+
else if (test.state === "failed") {
|
|
166
|
+
html += '<i class="text-error icon icon-cross"></i>';
|
|
167
|
+
this.stats.failed++;
|
|
168
|
+
}
|
|
169
|
+
else {
|
|
170
|
+
html += '<i class="text-warning icon icon-minus"></i>';
|
|
171
|
+
}
|
|
172
|
+
html += `</td><td>${test.title}`;
|
|
173
|
+
if (test.err) {
|
|
174
|
+
html += `<br/><span class="text-error">${test.err.name}: ${test.err.message}</span>`;
|
|
175
|
+
}
|
|
176
|
+
html += `</td>
|
|
177
|
+
<td class="duration">${test.duration ? this.msToMinutesAndSeconds(test.duration) : "-"}</td>
|
|
178
|
+
</tr>`;
|
|
179
|
+
}
|
|
180
|
+
if (afterAll.length && afterAll.some((aa) => aa.err)) {
|
|
181
|
+
html += '<tr><td class="state"><i class="text-error icon icon-cross"></i></td><td colspan="2">';
|
|
182
|
+
for (const aa of afterAll.filter((a) => a.err)) {
|
|
183
|
+
html += aa.title + ' failed: <br/><span class="text-error">' + aa.err.name + ": " + aa.err.message + "<br/>" + aa.err.stack + "</span>";
|
|
184
|
+
}
|
|
185
|
+
html += "</td></tr>";
|
|
186
|
+
}
|
|
187
|
+
html += "</table>";
|
|
188
|
+
return html;
|
|
189
|
+
}
|
|
190
|
+
generateSuites(suites, root = false) {
|
|
191
|
+
let html = "";
|
|
192
|
+
if (this.grep && root) {
|
|
193
|
+
suites = suites.filter((s) => this.grep.test(s.title));
|
|
194
|
+
}
|
|
195
|
+
for (const suite of suites) {
|
|
196
|
+
html += this.generateSuite(suite, root);
|
|
197
|
+
}
|
|
198
|
+
return html;
|
|
199
|
+
}
|
|
200
|
+
msToMinutesAndSeconds(ms) {
|
|
201
|
+
if (ms < 1000) {
|
|
202
|
+
return ms + "ms";
|
|
203
|
+
}
|
|
204
|
+
if (ms < 60000) {
|
|
205
|
+
return (ms / 1000) + "s";
|
|
206
|
+
}
|
|
207
|
+
ms = 1000 * Math.round(ms / 1000);
|
|
208
|
+
const d = new Date(ms);
|
|
209
|
+
return d.getUTCMinutes() + ":" + d.getUTCSeconds() + "m";
|
|
210
|
+
}
|
|
211
|
+
}
|
|
212
|
+
exports.HtmlReport = HtmlReport;
|
package/dist/index.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
export {};
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
export {};
|
package/dist/index.js
CHANGED
|
@@ -1,23 +1,23 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
"use strict";
|
|
3
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
-
const path = require("path");
|
|
5
|
-
const resolve = require("resolve");
|
|
6
|
-
const cli_1 = require("./cli");
|
|
7
|
-
process.title = "scifeon";
|
|
8
|
-
resolve("@scifeon/sdk", { basedir: process.cwd() }, function (err, res) {
|
|
9
|
-
let cli;
|
|
10
|
-
if (__dirname.includes(`client${path.sep}packages${path.sep}sdk${path.sep}dist`)) {
|
|
11
|
-
console.log("Using development version...");
|
|
12
|
-
cli = cli_1.ScifeonCLI;
|
|
13
|
-
}
|
|
14
|
-
else if (err) {
|
|
15
|
-
console.log("Using global NPM package...");
|
|
16
|
-
cli = cli_1.ScifeonCLI;
|
|
17
|
-
}
|
|
18
|
-
else {
|
|
19
|
-
console.log("Using local NPM package...");
|
|
20
|
-
cli = require(res).ScifeonCLI;
|
|
21
|
-
}
|
|
22
|
-
new cli().start();
|
|
23
|
-
});
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
"use strict";
|
|
3
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
+
const path = require("path");
|
|
5
|
+
const resolve = require("resolve");
|
|
6
|
+
const cli_1 = require("./cli");
|
|
7
|
+
process.title = "scifeon";
|
|
8
|
+
resolve("@scifeon/sdk", { basedir: process.cwd() }, function (err, res) {
|
|
9
|
+
let cli;
|
|
10
|
+
if (__dirname.includes(`client${path.sep}packages${path.sep}sdk${path.sep}dist`)) {
|
|
11
|
+
console.log("Using development version...");
|
|
12
|
+
cli = cli_1.ScifeonCLI;
|
|
13
|
+
}
|
|
14
|
+
else if (err) {
|
|
15
|
+
console.log("Using global NPM package...");
|
|
16
|
+
cli = cli_1.ScifeonCLI;
|
|
17
|
+
}
|
|
18
|
+
else {
|
|
19
|
+
console.log("Using local NPM package...");
|
|
20
|
+
cli = require(res).ScifeonCLI;
|
|
21
|
+
}
|
|
22
|
+
new cli().start();
|
|
23
|
+
});
|
package/dist/logger.d.ts
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
export declare class LOGGER {
|
|
2
|
-
static get verbose(): boolean;
|
|
3
|
-
static e2e: {
|
|
4
|
-
info: (msg: any) => void;
|
|
5
|
-
assertFail: (msg: any) => void;
|
|
6
|
-
assertSuccess: (msg: any) => void;
|
|
7
|
-
};
|
|
8
|
-
static warn(msg: string): void;
|
|
9
|
-
static error(msg: string): void;
|
|
10
|
-
static info(msg: string): void;
|
|
11
|
-
static msg(msg: string): void;
|
|
12
|
-
private static indentSpace;
|
|
13
|
-
constructor(quiet: boolean, verbose: boolean);
|
|
14
|
-
}
|
|
1
|
+
export declare class LOGGER {
|
|
2
|
+
static get verbose(): boolean;
|
|
3
|
+
static e2e: {
|
|
4
|
+
info: (msg: any) => void;
|
|
5
|
+
assertFail: (msg: any) => void;
|
|
6
|
+
assertSuccess: (msg: any) => void;
|
|
7
|
+
};
|
|
8
|
+
static warn(msg: string): void;
|
|
9
|
+
static error(msg: string): void;
|
|
10
|
+
static info(msg: string): void;
|
|
11
|
+
static msg(msg: string): void;
|
|
12
|
+
private static indentSpace;
|
|
13
|
+
constructor(quiet: boolean, verbose: boolean);
|
|
14
|
+
}
|
package/dist/logger.js
CHANGED
|
@@ -1,52 +1,52 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.LOGGER = void 0;
|
|
4
|
-
const chalk_1 = require("chalk");
|
|
5
|
-
const opts = {
|
|
6
|
-
quiet: false,
|
|
7
|
-
verbose: false,
|
|
8
|
-
};
|
|
9
|
-
class LOGGER {
|
|
10
|
-
constructor(quiet, verbose) {
|
|
11
|
-
opts.quiet = quiet;
|
|
12
|
-
opts.verbose = verbose;
|
|
13
|
-
}
|
|
14
|
-
static get verbose() {
|
|
15
|
-
return opts.verbose;
|
|
16
|
-
}
|
|
17
|
-
static warn(msg) {
|
|
18
|
-
if (opts.verbose) {
|
|
19
|
-
console.warn(chalk_1.default.bgYellow.black(" WARNING: ") + " " + msg);
|
|
20
|
-
}
|
|
21
|
-
}
|
|
22
|
-
static error(msg) {
|
|
23
|
-
console.error(chalk_1.default.bgRed.black(" ERROR: ") + " " + chalk_1.default.yellow(msg));
|
|
24
|
-
}
|
|
25
|
-
static info(msg) {
|
|
26
|
-
if (opts.verbose) {
|
|
27
|
-
console.log(chalk_1.default.bgBlue.white(" INFO: " + msg + " "));
|
|
28
|
-
}
|
|
29
|
-
}
|
|
30
|
-
static msg(msg) {
|
|
31
|
-
console.log(chalk_1.default.bgBlue.white(" > " + msg + " "));
|
|
32
|
-
}
|
|
33
|
-
static indentSpace() {
|
|
34
|
-
const len = global.e2eIndent >= 1 ? global.e2eIndent + 1 : global.e2eIndent;
|
|
35
|
-
return Array(len + 1).join(" ");
|
|
36
|
-
}
|
|
37
|
-
}
|
|
38
|
-
exports.LOGGER = LOGGER;
|
|
39
|
-
LOGGER.e2e = {
|
|
40
|
-
info: (msg) => {
|
|
41
|
-
msg = LOGGER.indentSpace() + " \u001b[37m> " + msg + " \u001b[0m";
|
|
42
|
-
console.log(msg);
|
|
43
|
-
},
|
|
44
|
-
assertFail: (msg) => {
|
|
45
|
-
msg = LOGGER.indentSpace() + " \u001b[31m\u00D7 \u001b[37m" + msg + " \u001b[0m";
|
|
46
|
-
console.log(msg);
|
|
47
|
-
},
|
|
48
|
-
assertSuccess: (msg) => {
|
|
49
|
-
msg = LOGGER.indentSpace() + " \u001b[32m\u221A \u001b[37m" + msg + " \u001b[0m";
|
|
50
|
-
console.log(msg);
|
|
51
|
-
},
|
|
52
|
-
};
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.LOGGER = void 0;
|
|
4
|
+
const chalk_1 = require("chalk");
|
|
5
|
+
const opts = {
|
|
6
|
+
quiet: false,
|
|
7
|
+
verbose: false,
|
|
8
|
+
};
|
|
9
|
+
class LOGGER {
|
|
10
|
+
constructor(quiet, verbose) {
|
|
11
|
+
opts.quiet = quiet;
|
|
12
|
+
opts.verbose = verbose;
|
|
13
|
+
}
|
|
14
|
+
static get verbose() {
|
|
15
|
+
return opts.verbose;
|
|
16
|
+
}
|
|
17
|
+
static warn(msg) {
|
|
18
|
+
if (opts.verbose) {
|
|
19
|
+
console.warn(chalk_1.default.bgYellow.black(" WARNING: ") + " " + msg);
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
static error(msg) {
|
|
23
|
+
console.error(chalk_1.default.bgRed.black(" ERROR: ") + " " + chalk_1.default.yellow(msg));
|
|
24
|
+
}
|
|
25
|
+
static info(msg) {
|
|
26
|
+
if (opts.verbose) {
|
|
27
|
+
console.log(chalk_1.default.bgBlue.white(" INFO: " + msg + " "));
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
static msg(msg) {
|
|
31
|
+
console.log(chalk_1.default.bgBlue.white(" > " + msg + " "));
|
|
32
|
+
}
|
|
33
|
+
static indentSpace() {
|
|
34
|
+
const len = global.e2eIndent >= 1 ? global.e2eIndent + 1 : global.e2eIndent;
|
|
35
|
+
return Array(len + 1).join(" ");
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
exports.LOGGER = LOGGER;
|
|
39
|
+
LOGGER.e2e = {
|
|
40
|
+
info: (msg) => {
|
|
41
|
+
msg = LOGGER.indentSpace() + " \u001b[37m> " + msg + " \u001b[0m";
|
|
42
|
+
console.log(msg);
|
|
43
|
+
},
|
|
44
|
+
assertFail: (msg) => {
|
|
45
|
+
msg = LOGGER.indentSpace() + " \u001b[31m\u00D7 \u001b[37m" + msg + " \u001b[0m";
|
|
46
|
+
console.log(msg);
|
|
47
|
+
},
|
|
48
|
+
assertSuccess: (msg) => {
|
|
49
|
+
msg = LOGGER.indentSpace() + " \u001b[32m\u221A \u001b[37m" + msg + " \u001b[0m";
|
|
50
|
+
console.log(msg);
|
|
51
|
+
},
|
|
52
|
+
};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
export declare enum MEASUREMENT_UNITS {
|
|
2
|
-
KILOGRAMM = "kg",
|
|
3
|
-
GRAMM = "g",
|
|
4
|
-
MILIGRAMM = "mg"
|
|
5
|
-
}
|
|
1
|
+
export declare enum MEASUREMENT_UNITS {
|
|
2
|
+
KILOGRAMM = "kg",
|
|
3
|
+
GRAMM = "g",
|
|
4
|
+
MILIGRAMM = "mg"
|
|
5
|
+
}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.MEASUREMENT_UNITS = void 0;
|
|
4
|
-
var MEASUREMENT_UNITS;
|
|
5
|
-
(function (MEASUREMENT_UNITS) {
|
|
6
|
-
MEASUREMENT_UNITS["KILOGRAMM"] = "kg";
|
|
7
|
-
MEASUREMENT_UNITS["GRAMM"] = "g";
|
|
8
|
-
MEASUREMENT_UNITS["MILIGRAMM"] = "mg";
|
|
9
|
-
})(MEASUREMENT_UNITS = exports.MEASUREMENT_UNITS || (exports.MEASUREMENT_UNITS = {}));
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.MEASUREMENT_UNITS = void 0;
|
|
4
|
+
var MEASUREMENT_UNITS;
|
|
5
|
+
(function (MEASUREMENT_UNITS) {
|
|
6
|
+
MEASUREMENT_UNITS["KILOGRAMM"] = "kg";
|
|
7
|
+
MEASUREMENT_UNITS["GRAMM"] = "g";
|
|
8
|
+
MEASUREMENT_UNITS["MILIGRAMM"] = "mg";
|
|
9
|
+
})(MEASUREMENT_UNITS = exports.MEASUREMENT_UNITS || (exports.MEASUREMENT_UNITS = {}));
|