ortoni-report 2.0.3 → 2.0.5
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/changelog.md +28 -0
- package/dist/ortoni-report.d.ts +32 -46
- package/dist/ortoni-report.js +23884 -826
- package/dist/ortoni-report.mjs +23886 -834
- package/dist/style/main.css +43 -1
- package/dist/utils/expressServer.js +33 -0
- package/dist/utils/utils.js +17 -1
- package/dist/utils/webSocketHelper.js +93 -0
- package/dist/views/main.hbs +202 -250
- package/dist/views/project.hbs +132 -0
- package/dist/views/summaryCard.hbs +5 -11
- package/dist/views/testPanel.hbs +2 -3
- package/dist/views/userInfo.hbs +193 -30
- package/package.json +6 -7
- package/readme.md +112 -65
- package/dist/cli/cli.js +0 -49
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.startReportServer = void 0;
|
|
7
|
+
const express_1 = __importDefault(require("express"));
|
|
8
|
+
/**
|
|
9
|
+
* Starts an Express server to serve the HTML report and keeps it running.
|
|
10
|
+
* @param {string} reportPath - Path to the folder where the report is stored.
|
|
11
|
+
* @param {string} reportFilename - Name of the HTML report file to serve.
|
|
12
|
+
* @param {number} port - Port number to serve the report on (default is 8080).
|
|
13
|
+
*/
|
|
14
|
+
function startReportServer(reportPath, reportFilename, port = 8080) {
|
|
15
|
+
const app = (0, express_1.default)();
|
|
16
|
+
// Serve static files from the report directory
|
|
17
|
+
app.use(express_1.default.static(reportPath));
|
|
18
|
+
// Start the server and keep it running
|
|
19
|
+
const server = app.listen(port, () => {
|
|
20
|
+
const reportUrl = `http://localhost:${port}/${reportFilename}`;
|
|
21
|
+
console.log(`Report is available at ${reportUrl}`);
|
|
22
|
+
});
|
|
23
|
+
// Ensure that the process doesn't exit prematurely
|
|
24
|
+
process.on('SIGINT', () => {
|
|
25
|
+
console.log('Shutting down the server...');
|
|
26
|
+
server.close(() => {
|
|
27
|
+
console.log('Server closed');
|
|
28
|
+
process.exit(0);
|
|
29
|
+
});
|
|
30
|
+
});
|
|
31
|
+
return server;
|
|
32
|
+
}
|
|
33
|
+
exports.startReportServer = startReportServer;
|
package/dist/utils/utils.js
CHANGED
|
@@ -3,7 +3,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.ensureHtmlExtension = exports.safeStringify = exports.formatDate = exports.normalizeFilePath = exports.msToTime = void 0;
|
|
6
|
+
exports.escapeHtml = exports.ensureHtmlExtension = exports.safeStringify = exports.formatDate = exports.normalizeFilePath = exports.msToTime = void 0;
|
|
7
7
|
const path_1 = __importDefault(require("path"));
|
|
8
8
|
function msToTime(duration) {
|
|
9
9
|
const milliseconds = Math.floor(duration % 1000);
|
|
@@ -67,3 +67,19 @@ function ensureHtmlExtension(filename) {
|
|
|
67
67
|
return `${filename}.html`;
|
|
68
68
|
}
|
|
69
69
|
exports.ensureHtmlExtension = ensureHtmlExtension;
|
|
70
|
+
function escapeHtml(unsafe) {
|
|
71
|
+
if (typeof unsafe !== 'string') {
|
|
72
|
+
return String(unsafe);
|
|
73
|
+
}
|
|
74
|
+
return unsafe.replace(/[&<"']/g, function (match) {
|
|
75
|
+
const escapeMap = {
|
|
76
|
+
'&': '&',
|
|
77
|
+
'<': '<',
|
|
78
|
+
'>': '>',
|
|
79
|
+
'"': '"',
|
|
80
|
+
"'": '''
|
|
81
|
+
};
|
|
82
|
+
return escapeMap[match] || match;
|
|
83
|
+
});
|
|
84
|
+
}
|
|
85
|
+
exports.escapeHtml = escapeHtml;
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
+
if (mod && mod.__esModule) return mod;
|
|
20
|
+
var result = {};
|
|
21
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
+
__setModuleDefault(result, mod);
|
|
23
|
+
return result;
|
|
24
|
+
};
|
|
25
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
26
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
27
|
+
};
|
|
28
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
29
|
+
const http_1 = __importDefault(require("http"));
|
|
30
|
+
const ws_1 = __importStar(require("ws"));
|
|
31
|
+
const utils_1 = require("./utils");
|
|
32
|
+
class WebSocketHelper {
|
|
33
|
+
constructor(port) {
|
|
34
|
+
this.port = port;
|
|
35
|
+
this.wss = null;
|
|
36
|
+
}
|
|
37
|
+
setupWebSocket() {
|
|
38
|
+
const server = http_1.default.createServer();
|
|
39
|
+
this.wss = new ws_1.WebSocketServer({ server });
|
|
40
|
+
this.wss.on('connection', (ws) => {
|
|
41
|
+
ws.send((0, utils_1.safeStringify)({ type: 'initial', data: 'Connected to WS service' }));
|
|
42
|
+
});
|
|
43
|
+
server.listen(this.port, () => {
|
|
44
|
+
console.log(`WebSocket server is running on http://localhost:${this.port}`);
|
|
45
|
+
});
|
|
46
|
+
}
|
|
47
|
+
setupCleanup() {
|
|
48
|
+
const gracefulShutdown = () => {
|
|
49
|
+
console.log('Shutting down WebSocket server...');
|
|
50
|
+
this.closeWebSocket();
|
|
51
|
+
process.exit();
|
|
52
|
+
};
|
|
53
|
+
process.on('exit', gracefulShutdown);
|
|
54
|
+
process.on('SIGINT', () => {
|
|
55
|
+
console.log('Received SIGINT. Closing WebSocket server...');
|
|
56
|
+
gracefulShutdown();
|
|
57
|
+
});
|
|
58
|
+
}
|
|
59
|
+
broadcastUpdate(tests) {
|
|
60
|
+
if (this.wss) {
|
|
61
|
+
this.wss.clients.forEach((client) => {
|
|
62
|
+
if (client.readyState === ws_1.default.OPEN) {
|
|
63
|
+
client.send((0, utils_1.safeStringify)({ type: 'update', data: tests }));
|
|
64
|
+
}
|
|
65
|
+
});
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
closeWebSocket() {
|
|
69
|
+
if (this.wss) {
|
|
70
|
+
this.wss.clients.forEach((client) => {
|
|
71
|
+
if (client.readyState === ws_1.default.OPEN) {
|
|
72
|
+
client.close(1000, 'Test run completed');
|
|
73
|
+
}
|
|
74
|
+
});
|
|
75
|
+
this.wss.close(() => {
|
|
76
|
+
console.log('WebSocket server closed');
|
|
77
|
+
});
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
testComplete() {
|
|
81
|
+
if (this.wss) {
|
|
82
|
+
this.wss.clients.forEach((client) => {
|
|
83
|
+
if (client.readyState === ws_1.default.OPEN) {
|
|
84
|
+
client.send((0, utils_1.safeStringify)({ type: 'complete', data: 'Test run completed' }));
|
|
85
|
+
}
|
|
86
|
+
});
|
|
87
|
+
}
|
|
88
|
+
setTimeout(() => {
|
|
89
|
+
this.closeWebSocket();
|
|
90
|
+
}, 1000);
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
exports.default = WebSocketHelper;
|