ortoni-report 4.0.1-beta.0 → 4.0.1
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 +17 -0
- package/dist/{chunk-MPZLDOCN.mjs → chunk-4RZ5C7KY.mjs} +408 -295
- package/dist/{cli/cli.js → cli.js} +405 -189
- package/dist/cli.mjs +208 -0
- package/dist/index.html +2 -2
- package/dist/ortoni-report.d.mts +7 -0
- package/dist/ortoni-report.d.ts +7 -0
- package/dist/ortoni-report.js +191 -74
- package/dist/ortoni-report.mjs +11 -7
- package/package.json +11 -4
- package/readme.md +56 -75
- package/dist/chunk-45EJSEX2.mjs +0 -632
- package/dist/chunk-75EAJL2U.mjs +0 -632
- package/dist/chunk-A6HCKATU.mjs +0 -76
- package/dist/chunk-FGIYOFIC.mjs +0 -632
- package/dist/chunk-FHKWBHU6.mjs +0 -633
- package/dist/chunk-GLICR3VS.mjs +0 -637
- package/dist/chunk-HFO6XSKC.mjs +0 -633
- package/dist/chunk-HOZD6YIV.mjs +0 -634
- package/dist/chunk-IJO2YIFE.mjs +0 -637
- package/dist/chunk-INS3E7E6.mjs +0 -638
- package/dist/chunk-JEIWNUQY.mjs +0 -632
- package/dist/chunk-JPLAGYR7.mjs +0 -632
- package/dist/chunk-NM6ULN2O.mjs +0 -632
- package/dist/chunk-OZS6QIJS.mjs +0 -638
- package/dist/chunk-P57227VN.mjs +0 -633
- package/dist/chunk-QMTRYN5N.js +0 -635
- package/dist/chunk-TI33PMMQ.mjs +0 -639
- package/dist/chunk-Z5NBP5TS.mjs +0 -635
- package/dist/cli/cli.cjs +0 -678
- package/dist/cli/cli.d.cts +0 -1
- package/dist/cli/cli.mjs +0 -103
- package/dist/ortoni-report.cjs +0 -2134
- package/dist/ortoni-report.d.cts +0 -111
- /package/dist/{cli/cli.d.mts → cli.d.mts} +0 -0
- /package/dist/{cli/cli.d.ts → cli.d.ts} +0 -0
package/dist/ortoni-report.d.mts
CHANGED
|
@@ -78,6 +78,13 @@ interface OrtoniReportConfig {
|
|
|
78
78
|
* @example { "key": "value" } as string
|
|
79
79
|
*/
|
|
80
80
|
meta?: Record<string, string>;
|
|
81
|
+
/**
|
|
82
|
+
* Save the history of the reports in a SQL file to be used in future reports.
|
|
83
|
+
* The history file will be saved in the report folder.
|
|
84
|
+
* @default true
|
|
85
|
+
* @example false (to disable)
|
|
86
|
+
*/
|
|
87
|
+
saveHistory?: boolean;
|
|
81
88
|
}
|
|
82
89
|
|
|
83
90
|
declare class OrtoniReport implements Reporter {
|
package/dist/ortoni-report.d.ts
CHANGED
|
@@ -78,6 +78,13 @@ interface OrtoniReportConfig {
|
|
|
78
78
|
* @example { "key": "value" } as string
|
|
79
79
|
*/
|
|
80
80
|
meta?: Record<string, string>;
|
|
81
|
+
/**
|
|
82
|
+
* Save the history of the reports in a SQL file to be used in future reports.
|
|
83
|
+
* The history file will be saved in the report folder.
|
|
84
|
+
* @default true
|
|
85
|
+
* @example false (to disable)
|
|
86
|
+
*/
|
|
87
|
+
saveHistory?: boolean;
|
|
81
88
|
}
|
|
82
89
|
|
|
83
90
|
declare class OrtoniReport implements Reporter {
|
package/dist/ortoni-report.js
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
"use strict";
|
|
2
1
|
var __create = Object.create;
|
|
3
2
|
var __defProp = Object.defineProperty;
|
|
4
3
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
@@ -38,68 +37,131 @@ __export(ortoni_report_exports, {
|
|
|
38
37
|
module.exports = __toCommonJS(ortoni_report_exports);
|
|
39
38
|
|
|
40
39
|
// src/helpers/fileManager.ts
|
|
40
|
+
var import_fs2 = __toESM(require("fs"));
|
|
41
|
+
var import_path2 = __toESM(require("path"));
|
|
42
|
+
|
|
43
|
+
// src/helpers/templateLoader.ts
|
|
41
44
|
var import_fs = __toESM(require("fs"));
|
|
42
45
|
var import_path = __toESM(require("path"));
|
|
46
|
+
var import_meta = {};
|
|
47
|
+
async function readBundledTemplate(pkgName = "ortoni-report") {
|
|
48
|
+
const packagedRel = "dist/index.html";
|
|
49
|
+
try {
|
|
50
|
+
if (typeof require === "function") {
|
|
51
|
+
const resolved = require.resolve(`${pkgName}/${packagedRel}`);
|
|
52
|
+
if (import_fs.default.existsSync(resolved)) {
|
|
53
|
+
return import_fs.default.readFileSync(resolved, "utf-8");
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
} catch {
|
|
57
|
+
}
|
|
58
|
+
try {
|
|
59
|
+
const moduleNS = await import("module");
|
|
60
|
+
if (moduleNS && typeof moduleNS.createRequire === "function") {
|
|
61
|
+
const createRequire = moduleNS.createRequire;
|
|
62
|
+
const req = createRequire(
|
|
63
|
+
// @ts-ignore
|
|
64
|
+
typeof __filename !== "undefined" ? __filename : import_meta.url
|
|
65
|
+
);
|
|
66
|
+
const resolved = req.resolve(`${pkgName}/${packagedRel}`);
|
|
67
|
+
if (import_fs.default.existsSync(resolved)) {
|
|
68
|
+
return import_fs.default.readFileSync(resolved, "utf-8");
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
} catch {
|
|
72
|
+
}
|
|
73
|
+
try {
|
|
74
|
+
const here = import_path.default.resolve(__dirname, "../dist/index.html");
|
|
75
|
+
if (import_fs.default.existsSync(here)) return import_fs.default.readFileSync(here, "utf-8");
|
|
76
|
+
} catch {
|
|
77
|
+
}
|
|
78
|
+
try {
|
|
79
|
+
const nm = import_path.default.join(process.cwd(), "node_modules", pkgName, packagedRel);
|
|
80
|
+
if (import_fs.default.existsSync(nm)) return import_fs.default.readFileSync(nm, "utf-8");
|
|
81
|
+
} catch {
|
|
82
|
+
}
|
|
83
|
+
try {
|
|
84
|
+
const alt = import_path.default.join(process.cwd(), "dist", "index.html");
|
|
85
|
+
if (import_fs.default.existsSync(alt)) return import_fs.default.readFileSync(alt, "utf-8");
|
|
86
|
+
} catch {
|
|
87
|
+
}
|
|
88
|
+
throw new Error(
|
|
89
|
+
`ortoni-report template not found (tried:
|
|
90
|
+
- require.resolve('${pkgName}/${packagedRel}')
|
|
91
|
+
- import('module').createRequire(...).resolve('${pkgName}/${packagedRel}')
|
|
92
|
+
- relative ../dist/index.html
|
|
93
|
+
- ${import_path.default.join(
|
|
94
|
+
process.cwd(),
|
|
95
|
+
"node_modules",
|
|
96
|
+
pkgName,
|
|
97
|
+
packagedRel
|
|
98
|
+
)}
|
|
99
|
+
- ${import_path.default.join(process.cwd(), "dist", "index.html")}
|
|
100
|
+
Ensure 'dist/index.html' is present in the published package and package.json 'files' includes 'dist/'.`
|
|
101
|
+
);
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
// src/helpers/fileManager.ts
|
|
43
105
|
var FileManager = class {
|
|
44
106
|
constructor(folderPath) {
|
|
45
107
|
this.folderPath = folderPath;
|
|
46
108
|
}
|
|
47
109
|
ensureReportDirectory() {
|
|
48
|
-
const ortoniDataFolder =
|
|
49
|
-
if (!
|
|
50
|
-
|
|
110
|
+
const ortoniDataFolder = import_path2.default.join(this.folderPath, "ortoni-data");
|
|
111
|
+
if (!import_fs2.default.existsSync(this.folderPath)) {
|
|
112
|
+
import_fs2.default.mkdirSync(this.folderPath, { recursive: true });
|
|
51
113
|
} else {
|
|
52
|
-
if (
|
|
53
|
-
|
|
114
|
+
if (import_fs2.default.existsSync(ortoniDataFolder)) {
|
|
115
|
+
import_fs2.default.rmSync(ortoniDataFolder, { recursive: true, force: true });
|
|
54
116
|
}
|
|
55
117
|
}
|
|
56
118
|
}
|
|
57
|
-
writeReportFile(filename, data) {
|
|
58
|
-
|
|
59
|
-
let html = import_fs.default.readFileSync(templatePath, "utf-8");
|
|
119
|
+
async writeReportFile(filename, data) {
|
|
120
|
+
let html = await readBundledTemplate();
|
|
60
121
|
const reportJSON = JSON.stringify({
|
|
61
122
|
data
|
|
62
123
|
});
|
|
63
124
|
html = html.replace("__ORTONI_TEST_REPORTDATA__", reportJSON);
|
|
64
|
-
|
|
65
|
-
|
|
125
|
+
const outputPath = import_path2.default.join(process.cwd(), this.folderPath, filename);
|
|
126
|
+
import_fs2.default.writeFileSync(outputPath, html);
|
|
127
|
+
return outputPath;
|
|
66
128
|
}
|
|
67
129
|
writeRawFile(filename, data) {
|
|
68
|
-
const outputPath =
|
|
69
|
-
|
|
130
|
+
const outputPath = import_path2.default.join(process.cwd(), this.folderPath, filename);
|
|
131
|
+
import_fs2.default.mkdirSync(import_path2.default.dirname(outputPath), { recursive: true });
|
|
70
132
|
const content = typeof data === "string" ? data : JSON.stringify(data, null, 2);
|
|
71
|
-
|
|
133
|
+
import_fs2.default.writeFileSync(outputPath, content, "utf-8");
|
|
72
134
|
return outputPath;
|
|
73
135
|
}
|
|
74
136
|
copyTraceViewerAssets(skip) {
|
|
75
137
|
if (skip) return;
|
|
76
|
-
const traceViewerFolder =
|
|
138
|
+
const traceViewerFolder = import_path2.default.join(
|
|
77
139
|
require.resolve("playwright-core"),
|
|
78
140
|
"..",
|
|
79
141
|
"lib",
|
|
80
142
|
"vite",
|
|
81
143
|
"traceViewer"
|
|
82
144
|
);
|
|
83
|
-
const traceViewerTargetFolder =
|
|
84
|
-
const traceViewerAssetsTargetFolder =
|
|
145
|
+
const traceViewerTargetFolder = import_path2.default.join(this.folderPath, "trace");
|
|
146
|
+
const traceViewerAssetsTargetFolder = import_path2.default.join(
|
|
85
147
|
traceViewerTargetFolder,
|
|
86
148
|
"assets"
|
|
87
149
|
);
|
|
88
|
-
|
|
89
|
-
for (const file of
|
|
150
|
+
import_fs2.default.mkdirSync(traceViewerAssetsTargetFolder, { recursive: true });
|
|
151
|
+
for (const file of import_fs2.default.readdirSync(traceViewerFolder)) {
|
|
90
152
|
if (file.endsWith(".map") || file.includes("watch") || file.includes("assets"))
|
|
91
153
|
continue;
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
154
|
+
import_fs2.default.copyFileSync(
|
|
155
|
+
import_path2.default.join(traceViewerFolder, file),
|
|
156
|
+
import_path2.default.join(traceViewerTargetFolder, file)
|
|
95
157
|
);
|
|
96
158
|
}
|
|
97
|
-
const assetsFolder =
|
|
98
|
-
for (const file of
|
|
159
|
+
const assetsFolder = import_path2.default.join(traceViewerFolder, "assets");
|
|
160
|
+
for (const file of import_fs2.default.readdirSync(assetsFolder)) {
|
|
99
161
|
if (file.endsWith(".map") || file.includes("xtermModule")) continue;
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
162
|
+
import_fs2.default.copyFileSync(
|
|
163
|
+
import_path2.default.join(assetsFolder, file),
|
|
164
|
+
import_path2.default.join(traceViewerAssetsTargetFolder, file)
|
|
103
165
|
);
|
|
104
166
|
}
|
|
105
167
|
}
|
|
@@ -148,13 +210,46 @@ var HTMLGenerator = class {
|
|
|
148
210
|
);
|
|
149
211
|
return data;
|
|
150
212
|
}
|
|
213
|
+
/**
|
|
214
|
+
* Return safe analytics/report data.
|
|
215
|
+
* If no dbManager is provided, return empty defaults and a note explaining why.
|
|
216
|
+
*/
|
|
151
217
|
async getReportData() {
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
218
|
+
if (!this.dbManager) {
|
|
219
|
+
return {
|
|
220
|
+
summary: {},
|
|
221
|
+
trends: {},
|
|
222
|
+
flakyTests: [],
|
|
223
|
+
slowTests: [],
|
|
224
|
+
note: "Test history/trends are unavailable (saveHistory disabled or DB not initialized)."
|
|
225
|
+
};
|
|
226
|
+
}
|
|
227
|
+
try {
|
|
228
|
+
const [summary, trends, flakyTests, slowTests] = await Promise.all([
|
|
229
|
+
this.dbManager.getSummaryData ? this.dbManager.getSummaryData() : Promise.resolve({}),
|
|
230
|
+
this.dbManager.getTrends ? this.dbManager.getTrends() : Promise.resolve({}),
|
|
231
|
+
this.dbManager.getFlakyTests ? this.dbManager.getFlakyTests() : Promise.resolve([]),
|
|
232
|
+
this.dbManager.getSlowTests ? this.dbManager.getSlowTests() : Promise.resolve([])
|
|
233
|
+
]);
|
|
234
|
+
return {
|
|
235
|
+
summary: summary ?? {},
|
|
236
|
+
trends: trends ?? {},
|
|
237
|
+
flakyTests: flakyTests ?? [],
|
|
238
|
+
slowTests: slowTests ?? []
|
|
239
|
+
};
|
|
240
|
+
} catch (err) {
|
|
241
|
+
console.warn(
|
|
242
|
+
"HTMLGenerator: failed to read analytics from DB, continuing without history.",
|
|
243
|
+
err
|
|
244
|
+
);
|
|
245
|
+
return {
|
|
246
|
+
summary: {},
|
|
247
|
+
trends: {},
|
|
248
|
+
flakyTests: [],
|
|
249
|
+
slowTests: [],
|
|
250
|
+
note: "Test history/trends could not be loaded due to a DB error."
|
|
251
|
+
};
|
|
252
|
+
}
|
|
158
253
|
}
|
|
159
254
|
async prepareReportData(filteredResults, totalDuration, results, projectSet) {
|
|
160
255
|
const totalTests = filteredResults.length;
|
|
@@ -163,10 +258,10 @@ var HTMLGenerator = class {
|
|
|
163
258
|
const failed = filteredResults.filter(
|
|
164
259
|
(r) => r.status === "failed" || r.status === "timedOut"
|
|
165
260
|
).length;
|
|
166
|
-
const successRate = ((passedTests + flakyTests) / totalTests * 100).toFixed(2);
|
|
261
|
+
const successRate = totalTests === 0 ? "0.00" : ((passedTests + flakyTests) / totalTests * 100).toFixed(2);
|
|
167
262
|
const allTags = /* @__PURE__ */ new Set();
|
|
168
263
|
results.forEach(
|
|
169
|
-
(result) => result.testTags.forEach((tag) => allTags.add(tag))
|
|
264
|
+
(result) => (result.testTags || []).forEach((tag) => allTags.add(tag))
|
|
170
265
|
);
|
|
171
266
|
const projectResults = this.calculateProjectResults(
|
|
172
267
|
filteredResults,
|
|
@@ -177,13 +272,31 @@ var HTMLGenerator = class {
|
|
|
177
272
|
const testHistories = await Promise.all(
|
|
178
273
|
results.map(async (result) => {
|
|
179
274
|
const testId = `${result.filePath}:${result.projectName}:${result.title}`;
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
275
|
+
if (!this.dbManager || !this.dbManager.getTestHistory) {
|
|
276
|
+
return {
|
|
277
|
+
testId,
|
|
278
|
+
history: []
|
|
279
|
+
};
|
|
280
|
+
}
|
|
281
|
+
try {
|
|
282
|
+
const history = await this.dbManager.getTestHistory(testId);
|
|
283
|
+
return {
|
|
284
|
+
testId,
|
|
285
|
+
history: history ?? []
|
|
286
|
+
};
|
|
287
|
+
} catch (err) {
|
|
288
|
+
console.warn(
|
|
289
|
+
`HTMLGenerator: failed to read history for ${testId}`,
|
|
290
|
+
err
|
|
291
|
+
);
|
|
292
|
+
return {
|
|
293
|
+
testId,
|
|
294
|
+
history: []
|
|
295
|
+
};
|
|
296
|
+
}
|
|
185
297
|
})
|
|
186
298
|
);
|
|
299
|
+
const reportData = await this.getReportData();
|
|
187
300
|
return {
|
|
188
301
|
summary: {
|
|
189
302
|
overAllResult: {
|
|
@@ -219,7 +332,7 @@ var HTMLGenerator = class {
|
|
|
219
332
|
showProject: this.ortoniConfig.showProject || false
|
|
220
333
|
},
|
|
221
334
|
analytics: {
|
|
222
|
-
reportData
|
|
335
|
+
reportData
|
|
223
336
|
}
|
|
224
337
|
};
|
|
225
338
|
}
|
|
@@ -257,16 +370,16 @@ var HTMLGenerator = class {
|
|
|
257
370
|
}
|
|
258
371
|
};
|
|
259
372
|
|
|
260
|
-
// src/helpers/resultProcessor
|
|
373
|
+
// src/helpers/resultProcessor.ts
|
|
261
374
|
var import_ansi_to_html = __toESM(require("ansi-to-html"));
|
|
262
|
-
var
|
|
375
|
+
var import_path5 = __toESM(require("path"));
|
|
263
376
|
|
|
264
377
|
// src/utils/attachFiles.ts
|
|
265
|
-
var
|
|
266
|
-
var
|
|
378
|
+
var import_path3 = __toESM(require("path"));
|
|
379
|
+
var import_fs4 = __toESM(require("fs"));
|
|
267
380
|
|
|
268
381
|
// src/helpers/markdownConverter.ts
|
|
269
|
-
var
|
|
382
|
+
var import_fs3 = __toESM(require("fs"));
|
|
270
383
|
|
|
271
384
|
// node_modules/marked/lib/marked.esm.js
|
|
272
385
|
function M() {
|
|
@@ -1392,27 +1505,27 @@ var Qt = b.lex;
|
|
|
1392
1505
|
|
|
1393
1506
|
// src/helpers/markdownConverter.ts
|
|
1394
1507
|
function convertMarkdownToHtml(markdownPath, htmlOutputPath) {
|
|
1395
|
-
const hasMarkdown =
|
|
1396
|
-
const markdownContent = hasMarkdown ?
|
|
1508
|
+
const hasMarkdown = import_fs3.default.existsSync(markdownPath);
|
|
1509
|
+
const markdownContent = hasMarkdown ? import_fs3.default.readFileSync(markdownPath, "utf-8") : "";
|
|
1397
1510
|
const markdownHtml = hasMarkdown ? k(markdownContent) : "";
|
|
1398
1511
|
const drawerHtml = `${markdownHtml || ""}`;
|
|
1399
|
-
|
|
1512
|
+
import_fs3.default.writeFileSync(htmlOutputPath, drawerHtml.trim(), "utf-8");
|
|
1400
1513
|
if (hasMarkdown) {
|
|
1401
|
-
|
|
1514
|
+
import_fs3.default.unlinkSync(markdownPath);
|
|
1402
1515
|
}
|
|
1403
1516
|
}
|
|
1404
1517
|
|
|
1405
1518
|
// src/utils/attachFiles.ts
|
|
1406
1519
|
function attachFiles(subFolder, result, testResult, config, steps, errors) {
|
|
1407
1520
|
const folderPath = config.folderPath || "ortoni-report";
|
|
1408
|
-
const attachmentsFolder =
|
|
1521
|
+
const attachmentsFolder = import_path3.default.join(
|
|
1409
1522
|
folderPath,
|
|
1410
1523
|
"ortoni-data",
|
|
1411
1524
|
"attachments",
|
|
1412
1525
|
subFolder
|
|
1413
1526
|
);
|
|
1414
|
-
if (!
|
|
1415
|
-
|
|
1527
|
+
if (!import_fs4.default.existsSync(attachmentsFolder)) {
|
|
1528
|
+
import_fs4.default.mkdirSync(attachmentsFolder, { recursive: true });
|
|
1416
1529
|
}
|
|
1417
1530
|
if (!result.attachments) return;
|
|
1418
1531
|
const { base64Image } = config;
|
|
@@ -1421,14 +1534,14 @@ function attachFiles(subFolder, result, testResult, config, steps, errors) {
|
|
|
1421
1534
|
result.attachments.forEach((attachment) => {
|
|
1422
1535
|
const { contentType, name, path: attachmentPath, body } = attachment;
|
|
1423
1536
|
if (!attachmentPath && !body) return;
|
|
1424
|
-
const fileName = attachmentPath ?
|
|
1425
|
-
const relativePath =
|
|
1537
|
+
const fileName = attachmentPath ? import_path3.default.basename(attachmentPath) : `${name}.${getFileExtension(contentType)}`;
|
|
1538
|
+
const relativePath = import_path3.default.join(
|
|
1426
1539
|
"ortoni-data",
|
|
1427
1540
|
"attachments",
|
|
1428
1541
|
subFolder,
|
|
1429
1542
|
fileName
|
|
1430
1543
|
);
|
|
1431
|
-
const fullPath =
|
|
1544
|
+
const fullPath = import_path3.default.join(attachmentsFolder, fileName);
|
|
1432
1545
|
if (contentType === "image/png") {
|
|
1433
1546
|
handleImage(
|
|
1434
1547
|
attachmentPath,
|
|
@@ -1471,13 +1584,13 @@ function handleImage(attachmentPath, body, base64Image, fullPath, relativePath,
|
|
|
1471
1584
|
let screenshotPath = "";
|
|
1472
1585
|
if (attachmentPath) {
|
|
1473
1586
|
try {
|
|
1474
|
-
const screenshotContent =
|
|
1587
|
+
const screenshotContent = import_fs4.default.readFileSync(
|
|
1475
1588
|
attachmentPath,
|
|
1476
1589
|
base64Image ? "base64" : void 0
|
|
1477
1590
|
);
|
|
1478
1591
|
screenshotPath = base64Image ? `data:image/png;base64,${screenshotContent}` : relativePath;
|
|
1479
1592
|
if (!base64Image) {
|
|
1480
|
-
|
|
1593
|
+
import_fs4.default.copyFileSync(attachmentPath, fullPath);
|
|
1481
1594
|
}
|
|
1482
1595
|
} catch (error) {
|
|
1483
1596
|
console.error(
|
|
@@ -1494,7 +1607,7 @@ function handleImage(attachmentPath, body, base64Image, fullPath, relativePath,
|
|
|
1494
1607
|
}
|
|
1495
1608
|
function handleAttachment(attachmentPath, fullPath, relativePath, resultKey, testResult, steps, errors) {
|
|
1496
1609
|
if (attachmentPath) {
|
|
1497
|
-
|
|
1610
|
+
import_fs4.default.copyFileSync(attachmentPath, fullPath);
|
|
1498
1611
|
if (resultKey === "videoPath") {
|
|
1499
1612
|
testResult[resultKey]?.push(relativePath);
|
|
1500
1613
|
} else if (resultKey === "tracePath") {
|
|
@@ -1520,13 +1633,13 @@ function getFileExtension(contentType) {
|
|
|
1520
1633
|
}
|
|
1521
1634
|
|
|
1522
1635
|
// src/utils/utils.ts
|
|
1523
|
-
var
|
|
1636
|
+
var import_path4 = __toESM(require("path"));
|
|
1524
1637
|
function normalizeFilePath(filePath) {
|
|
1525
|
-
const normalizedPath =
|
|
1526
|
-
return
|
|
1638
|
+
const normalizedPath = import_path4.default.normalize(filePath);
|
|
1639
|
+
return import_path4.default.basename(normalizedPath);
|
|
1527
1640
|
}
|
|
1528
1641
|
function ensureHtmlExtension(filename) {
|
|
1529
|
-
const ext =
|
|
1642
|
+
const ext = import_path4.default.extname(filename);
|
|
1530
1643
|
if (ext && ext.toLowerCase() === ".html") {
|
|
1531
1644
|
return filename;
|
|
1532
1645
|
}
|
|
@@ -1574,7 +1687,7 @@ function extractSuites(titlePath) {
|
|
|
1574
1687
|
};
|
|
1575
1688
|
}
|
|
1576
1689
|
|
|
1577
|
-
// src/helpers/resultProcessor
|
|
1690
|
+
// src/helpers/resultProcessor.ts
|
|
1578
1691
|
var TestResultProcessor = class {
|
|
1579
1692
|
constructor(projectRoot) {
|
|
1580
1693
|
this.ansiToHtml = new import_ansi_to_html.default({ fg: "var(--snippet-color)" });
|
|
@@ -1630,7 +1743,7 @@ var TestResultProcessor = class {
|
|
|
1630
1743
|
}
|
|
1631
1744
|
processSteps(steps) {
|
|
1632
1745
|
return steps.map((step) => {
|
|
1633
|
-
const stepLocation = step.location ? `${
|
|
1746
|
+
const stepLocation = step.location ? `${import_path5.default.relative(this.projectRoot, step.location.file)}:${step.location.line}:${step.location.column}` : "";
|
|
1634
1747
|
return {
|
|
1635
1748
|
snippet: this.ansiToHtml.toHtml(escapeHtml(step.error?.snippet || "")),
|
|
1636
1749
|
title: step.title,
|
|
@@ -1642,14 +1755,14 @@ var TestResultProcessor = class {
|
|
|
1642
1755
|
|
|
1643
1756
|
// src/utils/expressServer.ts
|
|
1644
1757
|
var import_express = __toESM(require("express"));
|
|
1645
|
-
var
|
|
1758
|
+
var import_path6 = __toESM(require("path"));
|
|
1646
1759
|
var import_child_process = require("child_process");
|
|
1647
1760
|
function startReportServer(reportFolder, reportFilename, port = 2004, open2) {
|
|
1648
1761
|
const app = (0, import_express.default)();
|
|
1649
|
-
app.use(import_express.default.static(reportFolder));
|
|
1762
|
+
app.use(import_express.default.static(reportFolder, { index: false }));
|
|
1650
1763
|
app.get("/", (_req, res) => {
|
|
1651
1764
|
try {
|
|
1652
|
-
res.sendFile(
|
|
1765
|
+
res.sendFile(import_path6.default.resolve(reportFolder, reportFilename));
|
|
1653
1766
|
} catch (error) {
|
|
1654
1767
|
console.error("Ortoni Report: Error sending report file:", error);
|
|
1655
1768
|
res.status(500).send("Error loading report");
|
|
@@ -1995,7 +2108,7 @@ var DatabaseManager = class {
|
|
|
1995
2108
|
};
|
|
1996
2109
|
|
|
1997
2110
|
// src/ortoni-report.ts
|
|
1998
|
-
var
|
|
2111
|
+
var import_path7 = __toESM(require("path"));
|
|
1999
2112
|
var OrtoniReport = class {
|
|
2000
2113
|
constructor(ortoniConfig = {}) {
|
|
2001
2114
|
this.ortoniConfig = ortoniConfig;
|
|
@@ -2026,7 +2139,7 @@ var OrtoniReport = class {
|
|
|
2026
2139
|
this.testResultProcessor = new TestResultProcessor(config.rootDir);
|
|
2027
2140
|
this.fileManager.ensureReportDirectory();
|
|
2028
2141
|
await this.dbManager.initialize(
|
|
2029
|
-
|
|
2142
|
+
import_path7.default.join(this.folderPath, "ortoni-data-history.sqlite")
|
|
2030
2143
|
);
|
|
2031
2144
|
this.shardConfig = config?.shard;
|
|
2032
2145
|
}
|
|
@@ -2068,8 +2181,8 @@ var OrtoniReport = class {
|
|
|
2068
2181
|
const shard = this.shardConfig;
|
|
2069
2182
|
const shardFile = `ortoni-shard-${shard.current}-of-${shard.total}.json`;
|
|
2070
2183
|
const shardData = {
|
|
2071
|
-
status: result.status,
|
|
2072
|
-
|
|
2184
|
+
// status: result.status,
|
|
2185
|
+
totalDuration,
|
|
2073
2186
|
results: this.results,
|
|
2074
2187
|
projectSet: Array.from(this.projectSet),
|
|
2075
2188
|
userConfig: {
|
|
@@ -2082,7 +2195,11 @@ var OrtoniReport = class {
|
|
|
2082
2195
|
meta: this.ortoniConfig.meta
|
|
2083
2196
|
}
|
|
2084
2197
|
};
|
|
2085
|
-
this.fileManager.writeRawFile(
|
|
2198
|
+
const shardFilePath = this.fileManager.writeRawFile(
|
|
2199
|
+
shardFile,
|
|
2200
|
+
shardData
|
|
2201
|
+
);
|
|
2202
|
+
console.info(`Ortoni Report: Shard data written to ${shardFilePath}`);
|
|
2086
2203
|
this.shouldGenerateReport = false;
|
|
2087
2204
|
return;
|
|
2088
2205
|
}
|
|
@@ -2095,7 +2212,7 @@ var OrtoniReport = class {
|
|
|
2095
2212
|
this.results,
|
|
2096
2213
|
this.projectSet
|
|
2097
2214
|
);
|
|
2098
|
-
this.outputPath = this.fileManager.writeReportFile(
|
|
2215
|
+
this.outputPath = await this.fileManager.writeReportFile(
|
|
2099
2216
|
this.outputFilename,
|
|
2100
2217
|
finalReportData
|
|
2101
2218
|
);
|
package/dist/ortoni-report.mjs
CHANGED
|
@@ -8,9 +8,9 @@ import {
|
|
|
8
8
|
extractSuites,
|
|
9
9
|
normalizeFilePath,
|
|
10
10
|
startReportServer
|
|
11
|
-
} from "./chunk-
|
|
11
|
+
} from "./chunk-4RZ5C7KY.mjs";
|
|
12
12
|
|
|
13
|
-
// src/helpers/resultProcessor
|
|
13
|
+
// src/helpers/resultProcessor.ts
|
|
14
14
|
import AnsiToHtml from "ansi-to-html";
|
|
15
15
|
import path2 from "path";
|
|
16
16
|
|
|
@@ -1272,7 +1272,7 @@ function getFileExtension(contentType) {
|
|
|
1272
1272
|
return extensions[contentType] || "unknown";
|
|
1273
1273
|
}
|
|
1274
1274
|
|
|
1275
|
-
// src/helpers/resultProcessor
|
|
1275
|
+
// src/helpers/resultProcessor.ts
|
|
1276
1276
|
var TestResultProcessor = class {
|
|
1277
1277
|
constructor(projectRoot) {
|
|
1278
1278
|
this.ansiToHtml = new AnsiToHtml({ fg: "var(--snippet-color)" });
|
|
@@ -1431,8 +1431,8 @@ var OrtoniReport = class {
|
|
|
1431
1431
|
const shard = this.shardConfig;
|
|
1432
1432
|
const shardFile = `ortoni-shard-${shard.current}-of-${shard.total}.json`;
|
|
1433
1433
|
const shardData = {
|
|
1434
|
-
status: result.status,
|
|
1435
|
-
|
|
1434
|
+
// status: result.status,
|
|
1435
|
+
totalDuration,
|
|
1436
1436
|
results: this.results,
|
|
1437
1437
|
projectSet: Array.from(this.projectSet),
|
|
1438
1438
|
userConfig: {
|
|
@@ -1445,7 +1445,11 @@ var OrtoniReport = class {
|
|
|
1445
1445
|
meta: this.ortoniConfig.meta
|
|
1446
1446
|
}
|
|
1447
1447
|
};
|
|
1448
|
-
this.fileManager.writeRawFile(
|
|
1448
|
+
const shardFilePath = this.fileManager.writeRawFile(
|
|
1449
|
+
shardFile,
|
|
1450
|
+
shardData
|
|
1451
|
+
);
|
|
1452
|
+
console.info(`Ortoni Report: Shard data written to ${shardFilePath}`);
|
|
1449
1453
|
this.shouldGenerateReport = false;
|
|
1450
1454
|
return;
|
|
1451
1455
|
}
|
|
@@ -1458,7 +1462,7 @@ var OrtoniReport = class {
|
|
|
1458
1462
|
this.results,
|
|
1459
1463
|
this.projectSet
|
|
1460
1464
|
);
|
|
1461
|
-
this.outputPath = this.fileManager.writeReportFile(
|
|
1465
|
+
this.outputPath = await this.fileManager.writeReportFile(
|
|
1462
1466
|
this.outputFilename,
|
|
1463
1467
|
finalReportData
|
|
1464
1468
|
);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "ortoni-report",
|
|
3
|
-
"version": "4.0.1
|
|
3
|
+
"version": "4.0.1",
|
|
4
4
|
"description": "Playwright Report By LetCode with Koushik",
|
|
5
5
|
"scripts": {
|
|
6
6
|
"tsc": "tsc",
|
|
@@ -8,10 +8,11 @@
|
|
|
8
8
|
"release": "npm publish"
|
|
9
9
|
},
|
|
10
10
|
"bin": {
|
|
11
|
-
"ortoni-report": "./dist/cli
|
|
11
|
+
"ortoni-report": "./dist/cli.js"
|
|
12
12
|
},
|
|
13
13
|
"files": [
|
|
14
|
-
"dist",
|
|
14
|
+
"dist/",
|
|
15
|
+
"dist/index.html",
|
|
15
16
|
"README.md",
|
|
16
17
|
"CHANGELOG.md"
|
|
17
18
|
],
|
|
@@ -52,5 +53,11 @@
|
|
|
52
53
|
},
|
|
53
54
|
"main": "dist/ortoni-report.js",
|
|
54
55
|
"module": "dist/ortoni-report.mjs",
|
|
55
|
-
"types": "dist/ortoni-report.d.ts"
|
|
56
|
+
"types": "dist/ortoni-report.d.ts",
|
|
57
|
+
"exports": {
|
|
58
|
+
".": {
|
|
59
|
+
"require": "./dist/ortoni-report.js",
|
|
60
|
+
"import": "./dist/ortoni-report.mjs"
|
|
61
|
+
}
|
|
62
|
+
}
|
|
56
63
|
}
|