ortoni-report 4.0.2-beta.1 → 4.0.3

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.
Files changed (62) hide show
  1. package/changelog.md +27 -0
  2. package/dist/{chunk-INS3E7E6.mjs → chunk-4RZ5C7KY.mjs} +402 -296
  3. package/dist/{cli/cli.js → cli.js} +405 -190
  4. package/dist/cli.mjs +208 -0
  5. package/dist/helpers/HTMLGenerator.d.ts +89 -0
  6. package/dist/helpers/HTMLGenerator.js +163 -0
  7. package/dist/helpers/databaseManager.d.ts +35 -0
  8. package/dist/helpers/databaseManager.js +268 -0
  9. package/dist/helpers/fileManager.d.ts +8 -0
  10. package/dist/helpers/fileManager.js +60 -0
  11. package/dist/helpers/markdownConverter.d.ts +1 -0
  12. package/dist/helpers/markdownConverter.js +14 -0
  13. package/dist/helpers/resultProcessor.d.ts +10 -0
  14. package/dist/helpers/resultProcessor.js +60 -0
  15. package/dist/helpers/serverManager.d.ts +6 -0
  16. package/dist/helpers/serverManager.js +15 -0
  17. package/dist/helpers/templateLoader.d.ts +15 -0
  18. package/dist/helpers/templateLoader.js +88 -0
  19. package/dist/index.html +1 -1
  20. package/dist/mergeData.d.ts +13 -0
  21. package/dist/mergeData.js +182 -0
  22. package/dist/ortoni-report.d.mts +8 -1
  23. package/dist/ortoni-report.d.ts +8 -1
  24. package/dist/ortoni-report.js +211 -96
  25. package/dist/ortoni-report.mjs +25 -22
  26. package/dist/{ortoni-report.d.cts → types/reporterConfig.d.ts} +8 -33
  27. package/dist/types/reporterConfig.js +1 -0
  28. package/dist/types/testResults.d.ts +31 -0
  29. package/dist/types/testResults.js +1 -0
  30. package/dist/utils/attachFiles.d.ts +4 -0
  31. package/dist/utils/attachFiles.js +87 -0
  32. package/dist/utils/expressServer.d.ts +1 -0
  33. package/dist/utils/expressServer.js +61 -0
  34. package/dist/utils/groupProjects.d.ts +3 -0
  35. package/dist/utils/groupProjects.js +30 -0
  36. package/dist/utils/utils.d.ts +15 -0
  37. package/dist/utils/utils.js +84 -0
  38. package/package.json +11 -4
  39. package/readme.md +60 -75
  40. package/dist/chunk-45EJSEX2.mjs +0 -632
  41. package/dist/chunk-75EAJL2U.mjs +0 -632
  42. package/dist/chunk-A6HCKATU.mjs +0 -76
  43. package/dist/chunk-FGIYOFIC.mjs +0 -632
  44. package/dist/chunk-FHKWBHU6.mjs +0 -633
  45. package/dist/chunk-GLICR3VS.mjs +0 -637
  46. package/dist/chunk-HFO6XSKC.mjs +0 -633
  47. package/dist/chunk-HOZD6YIV.mjs +0 -634
  48. package/dist/chunk-IJO2YIFE.mjs +0 -637
  49. package/dist/chunk-JEIWNUQY.mjs +0 -632
  50. package/dist/chunk-JPLAGYR7.mjs +0 -632
  51. package/dist/chunk-NM6ULN2O.mjs +0 -632
  52. package/dist/chunk-OZS6QIJS.mjs +0 -638
  53. package/dist/chunk-P57227VN.mjs +0 -633
  54. package/dist/chunk-QMTRYN5N.js +0 -635
  55. package/dist/chunk-TI33PMMQ.mjs +0 -639
  56. package/dist/chunk-Z5NBP5TS.mjs +0 -635
  57. package/dist/cli/cli.cjs +0 -678
  58. package/dist/cli/cli.d.cts +0 -1
  59. package/dist/cli/cli.mjs +0 -103
  60. package/dist/ortoni-report.cjs +0 -2134
  61. /package/dist/{cli/cli.d.mts → cli.d.mts} +0 -0
  62. /package/dist/{cli/cli.d.ts → cli.d.ts} +0 -0
package/dist/cli/cli.mjs DELETED
@@ -1,103 +0,0 @@
1
- #!/usr/bin/env node
2
- import {
3
- DatabaseManager,
4
- FileManager,
5
- HTMLGenerator,
6
- startReportServer
7
- } from "../chunk-JEIWNUQY.mjs";
8
-
9
- // src/cli/cli.ts
10
- import { program } from "commander";
11
- import * as fs2 from "fs";
12
- import * as path2 from "path";
13
-
14
- // src/cli/mergeData.ts
15
- import * as fs from "fs";
16
- import * as path from "path";
17
- async function mergerData(options) {
18
- const projectRoot = process.cwd();
19
- const folderPath = path.resolve(projectRoot, options.dir);
20
- console.info(`Ortoni Report: Merging shard files in folder: ${folderPath}`);
21
- const shardFiles = fs.readdirSync(folderPath).filter((f) => f.startsWith("ortoni-shard-") && f.endsWith(".json"));
22
- if (shardFiles.length === 0) {
23
- console.error("Ortoni Report: \u274C No shard files found to merge.");
24
- process.exit(1);
25
- }
26
- let allResults = [];
27
- let projectSet = /* @__PURE__ */ new Set();
28
- let totalDuration = 0;
29
- let mergedUserConfig = null;
30
- let mergedUserMeta = null;
31
- for (const file of shardFiles) {
32
- const shardData = JSON.parse(
33
- fs.readFileSync(path.join(folderPath, file), "utf-8")
34
- );
35
- allResults.push(...shardData.results);
36
- shardData.projectSet.forEach((p) => projectSet.add(p));
37
- totalDuration += shardData.duration;
38
- if (!mergedUserConfig && shardData.userConfig)
39
- mergedUserConfig = shardData.userConfig;
40
- if (!mergedUserMeta && shardData.userMeta)
41
- mergedUserMeta = shardData.userMeta;
42
- }
43
- const dbManager = new DatabaseManager();
44
- await dbManager.initialize(
45
- path.join(folderPath, "ortoni-data-history.sqlite")
46
- );
47
- const runId = await dbManager.saveTestRun();
48
- if (typeof runId === "number") {
49
- await dbManager.saveTestResults(runId, allResults);
50
- } else {
51
- console.error("Ortoni Report: \u274C Failed to save test run to database.");
52
- }
53
- const htmlGenerator = new HTMLGenerator(
54
- { ...mergedUserConfig, meta: mergedUserMeta?.meta },
55
- dbManager
56
- );
57
- const finalReportData = await htmlGenerator.generateFinalReport(
58
- allResults.filter((r) => r.status !== "skipped"),
59
- totalDuration,
60
- allResults,
61
- projectSet
62
- );
63
- const fileManager = new FileManager(folderPath);
64
- const outputFileName = options.file || "ortoni-report.html";
65
- const outputFilenamePath = path.join(folderPath, outputFileName);
66
- const outputPath = fileManager.writeReportFile(
67
- outputFilenamePath,
68
- finalReportData
69
- );
70
- console.log(`\u2705 Final merged report generated at ${outputPath}`);
71
- }
72
-
73
- // src/cli/cli.ts
74
- program.version("4.0.1").description("Ortoni Report - CLI");
75
- program.command("show-report").description("Open Ortoni Report").option(
76
- "-d, --dir <path>",
77
- "Path to the folder containing the report",
78
- "ortoni-report"
79
- ).option(
80
- "-f, --file <filename>",
81
- "Name of the report file",
82
- "ortoni-report.html"
83
- ).option("-p, --port <port>", "Port to run the server", "2004").action((options) => {
84
- const projectRoot = process.cwd();
85
- const folderPath = path2.resolve(projectRoot, options.dir);
86
- const filePath = path2.resolve(folderPath, options.file);
87
- const port = parseInt(options.port) || 2004;
88
- if (!fs2.existsSync(filePath)) {
89
- console.error(
90
- `\u274C Error: The file "${filePath}" does not exist in "${folderPath}".`
91
- );
92
- process.exit(1);
93
- }
94
- startReportServer(folderPath, path2.basename(filePath), port, "always");
95
- });
96
- program.command("merge-report").description("Merge sharded reports into one final report").option(
97
- "-d, --dir <path>",
98
- "Path to the folder containing shard files",
99
- "ortoni-report"
100
- ).option("-f, --file <filename>", "Output report file", "ortoni-report.html").action(async (options) => {
101
- await mergerData(options);
102
- });
103
- program.parse(process.argv);