ortoni-report 4.0.3 → 4.0.4

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/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;
@@ -175,7 +157,8 @@ var DatabaseManager = class {
175
157
  );
176
158
  return results.map((result) => ({
177
159
  ...result,
178
- run_date: formatDateLocal(result.run_date)
160
+ run_date: result.run_date
161
+ // Return raw ISO string to avoid parsing issues in browser
179
162
  }));
180
163
  } catch (error) {
181
164
  console.error("OrtoniReport: Error getting test history:", error);
@@ -258,7 +241,8 @@ var DatabaseManager = class {
258
241
  );
259
242
  return rows.reverse().map((row) => ({
260
243
  ...row,
261
- run_date: formatDateLocal(row.run_date),
244
+ run_date: row.run_date,
245
+ // Return raw ISO string for chart compatibility
262
246
  avg_duration: Math.round(row.avg_duration || 0)
263
247
  // raw ms avg
264
248
  }));
@@ -351,6 +335,28 @@ function groupResults(config, results) {
351
335
  }
352
336
  }
353
337
 
338
+ // src/utils/utils.ts
339
+ function formatDateLocal(dateInput) {
340
+ if (!dateInput) return "N/A";
341
+ try {
342
+ const date = typeof dateInput === "string" ? new Date(dateInput) : dateInput;
343
+ if (isNaN(date.getTime())) {
344
+ return "N/A";
345
+ }
346
+ const options = {
347
+ year: "numeric",
348
+ month: "short",
349
+ day: "2-digit",
350
+ hour: "2-digit",
351
+ minute: "2-digit",
352
+ hour12: true
353
+ };
354
+ return new Intl.DateTimeFormat("en-US", options).format(date);
355
+ } catch (e) {
356
+ return "N/A";
357
+ }
358
+ }
359
+
354
360
  // src/helpers/HTMLGenerator.ts
355
361
  var HTMLGenerator = class {
356
362
  constructor(ortoniConfig, dbManager) {
@@ -424,7 +430,7 @@ var HTMLGenerator = class {
424
430
  results,
425
431
  projectSet
426
432
  );
427
- const lastRunDate = (/* @__PURE__ */ new Date()).toLocaleString();
433
+ const lastRunDate = formatDateLocal(/* @__PURE__ */ new Date());
428
434
  const testHistories = await Promise.all(
429
435
  results.map(async (result) => {
430
436
  const testId = `${result.filePath}:${result.projectName}:${result.title}`;
package/dist/cli.mjs CHANGED
@@ -4,7 +4,7 @@ import {
4
4
  FileManager,
5
5
  HTMLGenerator,
6
6
  startReportServer
7
- } from "./chunk-4RZ5C7KY.mjs";
7
+ } from "./chunk-L6VOLEP2.mjs";
8
8
 
9
9
  // src/cli.ts
10
10
  import { program } from "commander";
@@ -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().toLocaleString();
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: formatDateLocal(result.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: formatDateLocal(row.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
  }