ortoni-report 4.0.3 → 4.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 +15 -12
- package/dist/chunk-KL7WIELF.mjs +750 -0
- package/dist/chunk-L6VOLEP2.mjs +752 -0
- package/dist/chunk-SQZD7MJL.mjs +750 -0
- package/dist/cli.js +32 -28
- package/dist/cli.mjs +1 -1
- package/dist/helpers/HTMLGenerator.js +2 -1
- package/dist/helpers/databaseManager.js +2 -3
- package/dist/helpers/serverManager.js +6 -2
- package/dist/index.html +2 -2
- package/dist/ortoni-report.js +609 -560
- package/dist/ortoni-report.mjs +533 -490
- package/dist/utils/utils.d.ts +1 -1
- package/dist/utils/utils.js +20 -11
- package/package.json +5 -4
- package/readme.md +1 -1
package/dist/cli.js
CHANGED
|
@@ -34,24 +34,6 @@ var path3 = __toESM(require("path"));
|
|
|
34
34
|
// src/helpers/databaseManager.ts
|
|
35
35
|
var import_sqlite = require("sqlite");
|
|
36
36
|
var import_sqlite3 = __toESM(require("sqlite3"));
|
|
37
|
-
|
|
38
|
-
// src/utils/utils.ts
|
|
39
|
-
function formatDateLocal(dateInput) {
|
|
40
|
-
const date = typeof dateInput === "string" ? new Date(dateInput) : dateInput;
|
|
41
|
-
const options = {
|
|
42
|
-
year: "numeric",
|
|
43
|
-
month: "short",
|
|
44
|
-
day: "2-digit",
|
|
45
|
-
hour: "2-digit",
|
|
46
|
-
minute: "2-digit",
|
|
47
|
-
hour12: true,
|
|
48
|
-
timeZoneName: "short"
|
|
49
|
-
// or "Asia/Kolkata"
|
|
50
|
-
};
|
|
51
|
-
return new Intl.DateTimeFormat(void 0, options).format(date);
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
// src/helpers/databaseManager.ts
|
|
55
37
|
var DatabaseManager = class {
|
|
56
38
|
constructor() {
|
|
57
39
|
this.db = null;
|
|
@@ -86,7 +68,6 @@ var DatabaseManager = class {
|
|
|
86
68
|
test_id TEXT,
|
|
87
69
|
status TEXT,
|
|
88
70
|
duration INTEGER, -- store duration as raw ms
|
|
89
|
-
error_message TEXT,
|
|
90
71
|
FOREIGN KEY (run_id) REFERENCES test_runs (id)
|
|
91
72
|
);
|
|
92
73
|
`);
|
|
@@ -136,17 +117,16 @@ var DatabaseManager = class {
|
|
|
136
117
|
try {
|
|
137
118
|
await this.db.exec("BEGIN TRANSACTION;");
|
|
138
119
|
const stmt = await this.db.prepare(`
|
|
139
|
-
INSERT INTO test_results (run_id, test_id, status, duration
|
|
140
|
-
VALUES (?, ?, ?,
|
|
120
|
+
INSERT INTO test_results (run_id, test_id, status, duration)
|
|
121
|
+
VALUES (?, ?, ?, ?)
|
|
141
122
|
`);
|
|
142
123
|
for (const result of results) {
|
|
143
124
|
await stmt.run([
|
|
144
125
|
runId,
|
|
145
126
|
`${result.filePath}:${result.projectName}:${result.title}`,
|
|
146
127
|
result.status,
|
|
147
|
-
result.duration
|
|
128
|
+
result.duration
|
|
148
129
|
// store raw ms
|
|
149
|
-
result.errors.join("\n")
|
|
150
130
|
]);
|
|
151
131
|
}
|
|
152
132
|
await stmt.finalize();
|
|
@@ -156,7 +136,7 @@ var DatabaseManager = class {
|
|
|
156
136
|
console.error("OrtoniReport: Error saving test results:", error);
|
|
157
137
|
}
|
|
158
138
|
}
|
|
159
|
-
async getTestHistory(testId, limit =
|
|
139
|
+
async getTestHistory(testId, limit = 25) {
|
|
160
140
|
if (!this.db) {
|
|
161
141
|
console.error("OrtoniReport: Database not initialized");
|
|
162
142
|
return [];
|
|
@@ -164,7 +144,7 @@ var DatabaseManager = class {
|
|
|
164
144
|
try {
|
|
165
145
|
const results = await this.db.all(
|
|
166
146
|
`
|
|
167
|
-
SELECT tr.status, tr.duration,
|
|
147
|
+
SELECT tr.status, tr.duration, trun.run_date
|
|
168
148
|
FROM test_results tr
|
|
169
149
|
JOIN test_runs trun ON tr.run_id = trun.id
|
|
170
150
|
WHERE tr.test_id = ?
|
|
@@ -175,7 +155,8 @@ var DatabaseManager = class {
|
|
|
175
155
|
);
|
|
176
156
|
return results.map((result) => ({
|
|
177
157
|
...result,
|
|
178
|
-
run_date:
|
|
158
|
+
run_date: result.run_date
|
|
159
|
+
// Return raw ISO string to avoid parsing issues in browser
|
|
179
160
|
}));
|
|
180
161
|
} catch (error) {
|
|
181
162
|
console.error("OrtoniReport: Error getting test history:", error);
|
|
@@ -258,7 +239,8 @@ var DatabaseManager = class {
|
|
|
258
239
|
);
|
|
259
240
|
return rows.reverse().map((row) => ({
|
|
260
241
|
...row,
|
|
261
|
-
run_date:
|
|
242
|
+
run_date: row.run_date,
|
|
243
|
+
// Return raw ISO string for chart compatibility
|
|
262
244
|
avg_duration: Math.round(row.avg_duration || 0)
|
|
263
245
|
// raw ms avg
|
|
264
246
|
}));
|
|
@@ -351,6 +333,28 @@ function groupResults(config, results) {
|
|
|
351
333
|
}
|
|
352
334
|
}
|
|
353
335
|
|
|
336
|
+
// src/utils/utils.ts
|
|
337
|
+
function formatDateLocal(dateInput) {
|
|
338
|
+
if (!dateInput) return "N/A";
|
|
339
|
+
try {
|
|
340
|
+
const date = typeof dateInput === "string" ? new Date(dateInput) : dateInput;
|
|
341
|
+
if (isNaN(date.getTime())) {
|
|
342
|
+
return "N/A";
|
|
343
|
+
}
|
|
344
|
+
const options = {
|
|
345
|
+
year: "numeric",
|
|
346
|
+
month: "short",
|
|
347
|
+
day: "2-digit",
|
|
348
|
+
hour: "2-digit",
|
|
349
|
+
minute: "2-digit",
|
|
350
|
+
hour12: true
|
|
351
|
+
};
|
|
352
|
+
return new Intl.DateTimeFormat("en-US", options).format(date);
|
|
353
|
+
} catch (e) {
|
|
354
|
+
return "N/A";
|
|
355
|
+
}
|
|
356
|
+
}
|
|
357
|
+
|
|
354
358
|
// src/helpers/HTMLGenerator.ts
|
|
355
359
|
var HTMLGenerator = class {
|
|
356
360
|
constructor(ortoniConfig, dbManager) {
|
|
@@ -424,7 +428,7 @@ var HTMLGenerator = class {
|
|
|
424
428
|
results,
|
|
425
429
|
projectSet
|
|
426
430
|
);
|
|
427
|
-
const lastRunDate = (/* @__PURE__ */ new Date())
|
|
431
|
+
const lastRunDate = formatDateLocal(/* @__PURE__ */ new Date());
|
|
428
432
|
const testHistories = await Promise.all(
|
|
429
433
|
results.map(async (result) => {
|
|
430
434
|
const testId = `${result.filePath}:${result.projectName}:${result.title}`;
|
package/dist/cli.mjs
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { groupResults } from "../utils/groupProjects";
|
|
2
|
+
import { formatDateLocal } from "../utils/utils";
|
|
2
3
|
export class HTMLGenerator {
|
|
3
4
|
constructor(ortoniConfig, dbManager) {
|
|
4
5
|
this.ortoniConfig = ortoniConfig;
|
|
@@ -66,7 +67,7 @@ export class HTMLGenerator {
|
|
|
66
67
|
const allTags = new Set();
|
|
67
68
|
results.forEach((result) => (result.testTags || []).forEach((tag) => allTags.add(tag)));
|
|
68
69
|
const projectResults = this.calculateProjectResults(filteredResults, results, projectSet);
|
|
69
|
-
const lastRunDate = new Date()
|
|
70
|
+
const lastRunDate = formatDateLocal(new Date());
|
|
70
71
|
// Fetch per-test histories only if DB manager exists; otherwise return empty history arrays.
|
|
71
72
|
const testHistories = await Promise.all(results.map(async (result) => {
|
|
72
73
|
const testId = `${result.filePath}:${result.projectName}:${result.title}`;
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { open } from "sqlite";
|
|
2
2
|
import sqlite3 from "sqlite3";
|
|
3
|
-
import { formatDateLocal } from "../utils/utils";
|
|
4
3
|
export class DatabaseManager {
|
|
5
4
|
constructor() {
|
|
6
5
|
this.db = null;
|
|
@@ -122,7 +121,7 @@ export class DatabaseManager {
|
|
|
122
121
|
`, [testId, limit]);
|
|
123
122
|
return results.map((result) => ({
|
|
124
123
|
...result,
|
|
125
|
-
run_date:
|
|
124
|
+
run_date: result.run_date, // Return raw ISO string to avoid parsing issues in browser
|
|
126
125
|
}));
|
|
127
126
|
}
|
|
128
127
|
catch (error) {
|
|
@@ -207,7 +206,7 @@ export class DatabaseManager {
|
|
|
207
206
|
`, [limit]);
|
|
208
207
|
return rows.reverse().map((row) => ({
|
|
209
208
|
...row,
|
|
210
|
-
run_date:
|
|
209
|
+
run_date: row.run_date,
|
|
211
210
|
avg_duration: Math.round(row.avg_duration || 0), // raw ms avg
|
|
212
211
|
}));
|
|
213
212
|
}
|
|
@@ -6,10 +6,14 @@ export class ServerManager {
|
|
|
6
6
|
async startServer(folderPath, outputFilename, overAllStatus) {
|
|
7
7
|
const openOption = this.ortoniConfig.open || "never";
|
|
8
8
|
const hasFailures = overAllStatus === "failed";
|
|
9
|
-
|
|
10
|
-
|
|
9
|
+
const isCI = !!process.env.CI;
|
|
10
|
+
if (!isCI &&
|
|
11
|
+
(openOption === "always" || (openOption === "on-failure" && hasFailures))) {
|
|
11
12
|
startReportServer(folderPath, outputFilename, this.ortoniConfig.port, openOption);
|
|
12
13
|
await new Promise((_resolve) => { });
|
|
13
14
|
}
|
|
15
|
+
else if (isCI && openOption !== "never") {
|
|
16
|
+
console.info("Ortoni Report: 'open' option ignored because process is running in CI.");
|
|
17
|
+
}
|
|
14
18
|
}
|
|
15
19
|
}
|