ortoni-report 3.0.2 → 3.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.
package/changelog.md CHANGED
@@ -1,69 +1,96 @@
1
1
  # Change Log:
2
2
 
3
+ ## v3.0.3
4
+
5
+ #### 📦 New Features
6
+
7
+ - Added a "Copy" button next to test spec file line numbers for quick sharing or navigation.
8
+ - Enabled support to open Markdown files, useful for AI-generated code snippets or documentation.
9
+
10
+ #### 🐛 Bug Fixes
11
+
12
+ - Fixed extra top spacing issue on the Analytics page.
13
+
14
+ #### 👌 Improvements
15
+
16
+ - Displayed test trends in ascending order for better chronological clarity.
17
+ - Skipped copying the trace folder when disabled via user configuration to optimize report generation.
18
+
3
19
  ## v3.0.2
4
20
 
5
21
  #### 📦 New Features
22
+
6
23
  1. Test Analytics dashboard
7
- - Shows summary of total runs, totals test, passed, failed, pass rate and average duration
8
- - Trends over time - upto 30 runs
9
- - Top flaky test list
10
- - slowest test list with average duration
24
+
25
+ - Shows summary of total runs, totals test, passed, failed, pass rate and average duration
26
+ - Trends over time - upto 30 runs
27
+ - Top flaky test list
28
+ - slowest test list with average duration
11
29
 
12
30
  #### 👌 Improvements
13
- 1. Set chart option as pie or doughnut for summary and projects
14
31
 
32
+ 1. Set chart option as pie or doughnut for summary and projects
15
33
 
16
34
  ## v3.0.1
17
35
 
18
36
  #### 👌 Improvements
19
37
 
20
38
  1. **Logo**:
21
- - Add project specific logo to the dashboard page
22
- - If logo is present then Dashboar text is hidden
39
+
40
+ - Add project specific logo to the dashboard page
41
+ - If logo is present then Dashboar text is hidden
23
42
 
24
43
  2. **Bundler size**:
25
- - Reduced bundler package size from 1.20 mB to 104 kB
26
- - Reduced bundler unpacked size from 5 mB to 760 kB
27
44
 
28
- 3. **Test History**
29
- - Improved test history UI
45
+ - Reduced bundler package size from 1.20 mB to 104 kB
46
+ - Reduced bundler unpacked size from 5 mB to 760 kB
47
+
48
+ 3. **Test History**
49
+
50
+ - Improved test history UI
30
51
 
31
52
  4. **Chart**
32
- - Improved chart layout with plot area chart for summary
53
+
54
+ - Improved chart layout with plot area chart for summary
33
55
 
34
56
  #### 🐛 Fixes
35
57
 
36
58
  1. Percentage is taking retry also in count #64
37
59
 
38
-
39
60
  ## v3.0.0
40
61
 
41
62
  #### 📦 New Features
63
+
42
64
  1. **SideBar**:
43
65
 
44
- - Navbar is removed and a new side bar is introduces.
45
- - Summay and Tests in 2 different section
66
+ - Navbar is removed and a new side bar is introduces.
67
+ - Summay and Tests in 2 different section
46
68
 
47
69
  2. **New Color Scheme**:
48
- - All new design to enhance the user viewing and exploring options
49
- - New Color scheme supports both dark and light theme
70
+
71
+ - All new design to enhance the user viewing and exploring options
72
+ - New Color scheme supports both dark and light theme
50
73
 
51
74
  3. **Meta section**:
52
- - User can add meta information about the project or release cycle (Refer to the example)
75
+
76
+ - User can add meta information about the project or release cycle (Refer to the example)
53
77
 
54
78
  4. **Overall redisgn**:
55
- - A new fresh UI look and perfomance increase
56
79
 
80
+ - A new fresh UI look and perfomance increase
57
81
 
58
82
  ## v2.0.9
59
83
 
60
84
  #### 📦 New Features
85
+
61
86
  - **Command to Open Report (CLI)**: Introduced a new command to open the Ortoni Report directly for streamlined access.
87
+
62
88
  ```
63
89
  npx ortoni-report show-report
64
90
  ```
65
91
 
66
92
  #### 👌 Improvements
93
+
67
94
  - **Database Optimization**: Enhanced database operations with transactions and indexing for better performance and reliability.
68
95
  - **CSS and UI Enhancements**:
69
96
  - Improved tabbed design for steps, errors, and logs (#50), ensuring an organized and intuitive user experience.
@@ -75,32 +102,37 @@ npx ortoni-report show-report
75
102
  ## v2.0.8
76
103
 
77
104
  #### 🐛 Fixes
105
+
78
106
  - **Peer Dependency**: Added peer dependecy to avoid external package conflict
79
107
 
80
108
  ## v2.0.7
81
109
 
82
110
  #### 📦 New Features
111
+
83
112
  - **Test History Display**: Added support for displaying test history up to the last 10 executions, providing better insight into recent test performance.
84
113
  - **Console Error Reporting**: Enhanced with console error display and the ability to skip report generation if no tests are found.
85
114
  - **Console Log Configuration**: Introduced a new `console` boolean configuration option to toggle the display of test console logs, set to `true` by default.
86
115
 
87
116
  #### 👌 Improvements
117
+
88
118
  - **UI and CSS Enhancements**:
89
119
  - Updated CSS color scheme and implemented minor UI tweaks for a more polished look.
90
120
  - Added project-specific icons for Chromium, Firefox, and WebKit to make test projects easily identifiable.
91
121
 
92
122
  #### 🐛 Fixes
93
- - **Trace Link Bug (#38)**: Fixed an issue where the trace link only captured the origin and not the pathname, ensuring accurate trace navigation.
94
-
95
123
 
124
+ - **Trace Link Bug (#38)**: Fixed an issue where the trace link only captured the origin and not the pathname, ensuring accurate trace navigation.
96
125
 
97
126
  ## v2.0.6
98
127
 
99
128
  #### 🐛 Fixes
129
+
100
130
  - **Trace Path in Pipeline**: Resolved issue with incorrect trace file path in CI/CD pipeline, ensuring trace paths are properly resolved.
101
131
 
102
132
  #### 👌 Improvements
133
+
103
134
  - **Search Functionality**:
135
+
104
136
  - **Removed from Navbar**: Search functionality has been removed from the navbar to enhance navigation simplicity.
105
137
  - **Added to Test Panel**: Search functionality has been relocated to the test panel for more intuitive test filtering.
106
138
 
@@ -110,17 +142,20 @@ npx ortoni-report show-report
110
142
  ## v2.0.5
111
143
 
112
144
  ### 🚀 New Features
145
+
113
146
  - **Open report in localhost**: Introduced the ability to open the report on localhost with configurable options:
114
147
  - `open?: "always" | "never" | "on-failure"`.
115
148
  - **Open Trace viewer within the same browser**: Added functionality to view the Playwright trace within the same browser tab, enhancing the user experience.
116
149
 
117
150
  ### ✨ Improvements
151
+
118
152
  - **Perfect Test content UI**: Enhanced the UI of the test content for a more polished and user-friendly interface.
119
153
  - **Refactored code with multiple classes and utilities**: Codebase has been refactored for better organization, incorporating multiple classes and utilities to improve maintainability and scalability.
120
154
 
121
155
  ## Version 2.0.4
122
156
 
123
157
  ### 🚀 New Features
158
+
124
159
  - **Tags & Annotations**: Added support for tags and annotations, allowing for more detailed reporting and metadata.
125
160
  - **Project charts & summary UI**: Enhanced the user interface of project charts and the summary section for better presentation and usability.
126
161
 
@@ -129,21 +164,24 @@ npx ortoni-report show-report
129
164
  - **Snippets color**: Improved the color scheme of code snippets for better readability.
130
165
 
131
166
  ### 🛠 Fixes
167
+
132
168
  - **Console warning**: Resolved a console warning issue, improving overall stability.
133
169
 
134
170
  ### Documentation
135
- - **Removed colors package**: Updated documentation to reflect the removal of the `colors` package.
136
171
 
172
+ - **Removed colors package**: Updated documentation to reflect the removal of the `colors` package.
137
173
 
138
174
  ## Version 2.0.3
139
175
 
140
176
  #### 🚀 New Features
177
+
141
178
  - **Add screenshot attachment as pagination**: Now supports adding screenshot attachments for easier navigation and pagination.
142
179
  - **Bulma Inline CSS**: Integrated Bulma inline CSS for improved styling.
143
180
  - **Show card if the count has value**: Cards will now appear only when a valid count is present.
144
181
  - **Folder Path**: Introduced a new feature to store the result in the folder path.
145
182
 
146
183
  #### ✨ Improvements
184
+
147
185
  - **Chart JS as CDN**: Enhanced performance by switching Chart.js to be served via CDN.
148
186
  - **Theme icon, navbar & summary icons**: Refined the design of theme icons, navbar, and summary icons for a better user experience.
149
187
  - **User meta icons**: Updated and improved the appearance of user meta icons.
@@ -158,23 +196,24 @@ npx ortoni-report show-report
158
196
 
159
197
  - **Show or Hide Projects in Test List**
160
198
  - You can now show or hide specific projects in the test list.
161
- - ```showProject: true``` from config
162
-
199
+ - `showProject: true` from config
163
200
  - **Document Title from Config**
201
+
164
202
  - The document title is now configurable via the configuration file, allowing you to customize it to your preference.
165
203
 
166
204
  - **Display Tags in Test Section**
205
+
167
206
  - Tags associated with tests are now displayed within the test section, giving you a clearer overview of test categories.
168
207
 
169
208
  - **Project and Tags Added to Filter**
170
209
  - We've added the ability to filter tests by both project and tags, enhancing the granularity of your test views.
171
-
172
210
  - **Display Selected Status on UI**
173
211
  - The selected status filter is now visible on the UI, making it easier to track the current filter settings.
174
212
 
175
213
  #### 🛠 Fixes
176
214
 
177
215
  - **Project Drop-down Z-Index on Screenshot**
216
+
178
217
  - Resolved an issue where the project drop-down menu was being overlapped by screenshots. The z-index has been adjusted for proper layering.
179
218
 
180
219
  - **Project Filter Hide Test Steps**
@@ -183,17 +222,19 @@ npx ortoni-report show-report
183
222
  #### ✨ Improvements
184
223
 
185
224
  - **Hide Skipped Tests on All Tests Filter**
225
+
186
226
  - Skipped tests are now hidden by default when using the "All Tests" filter, providing a cleaner and more focused view of relevant tests.
187
227
 
188
228
  - **Colorful Dashboard**
189
229
  - We've enhanced the visual appeal of the dashboard with more vibrant and intuitive colors, making it easier to navigate and interpret results.
190
230
 
191
-
192
231
  ## Version 2.0.1
232
+
193
233
  - Fixed local and root path issue of Parcel bundler.
194
234
  - Local config issue
195
235
 
196
236
  ## Version 2.0.0
237
+
197
238
  - Fixed local and root path issue of Parcel bundler.
198
239
 
199
240
  ## Version 1.1.9
@@ -206,9 +247,9 @@ npx ortoni-report show-report
206
247
  ### Command-Line Interface
207
248
 
208
249
  - **Generate Report Command**: Added a new CLI command to generate and bundle the report:
209
- ```sh
210
- npx ortoni-report gr
211
- ```
250
+ ```sh
251
+ npx ortoni-report gr
252
+ ```
212
253
  This command allows users to easily generate the report with a single command.
213
254
 
214
255
  ### Enhancements
@@ -216,27 +257,31 @@ npx ortoni-report show-report
216
257
  - **Bundled Report**: The generated report is now bundled into a single file, making it easier to zip and share.
217
258
  - **Storage Location**: The bundled report is stored in the `project/ortoni-report` folder for better organization and accessibility.
218
259
 
219
-
220
260
  ## Version 1.1.8
221
261
 
222
262
  ### Fixed
263
+
223
264
  - CSS issue
224
265
 
225
266
  ## Version 1.1.7
226
267
 
227
268
  ### Fixed
269
+
228
270
  - Layout issue where the test column extends off-screen
229
- - Screenshot layout of tests executed on mobile viewport
271
+ - Screenshot layout of tests executed on mobile viewport
230
272
 
231
273
  ### New
274
+
232
275
  - Add custom project/organization logo
233
276
  - Exception handling in `ortoni-report.ts`
234
277
  - Added docs to the `OrtoniReportConfig`
235
278
 
236
279
  ### Improved
280
+
237
281
  - Margin on Test List for better spacing
238
282
 
239
283
  ## Version 1.1.6
284
+
240
285
  - Implemented debounce function to reduce search event handling frequency.
241
286
  - Modified steps details to open only if a test has errors, enhancing UI clarity.
242
287
  - Optimized data load by removing unnecessary inner steps, improving performance.
@@ -246,18 +291,15 @@ npx ortoni-report show-report
246
291
  - Introduced user option to choose between base64 images and file path for screenshots.
247
292
 
248
293
  ## Version 1.1.5
294
+
249
295
  - Added config properly to readme
250
296
 
251
297
  ## Version 1.1.4
252
298
 
253
299
  1. **CSS Enhancement**: Updated CSS framework to Bulma for improved visualization and mobile responsiveness.
254
-
255
300
  2. **Screenshots**: Implemented screenshot attachment as base64 images for enhanced report details.
256
-
257
301
  3. **Toggle Theme Button**: Added a toggle theme button allowing users to switch between dark and light themes for better readability.
258
-
259
302
  4. **Project Filtering**: Implemented filtering of tests by projects (e.g., chromium, firefox) to streamline test result views.
260
-
261
303
  5. **Configuration Option**: Introduced `OrtoniReportConfig` for customizable report settings:
262
304
  ```typescript
263
305
  import {OrtoniReportConfig} from "ortoni-report";
@@ -271,16 +313,17 @@ npx ortoni-report show-report
271
313
  ```
272
314
  6. **Design Improvements**: Made overall design enhancements and added CSS transitions for smoother user interactions.
273
315
 
274
-
275
316
  ## Version 1.1.3
276
317
 
277
318
  **New Features:**
319
+
278
320
  - Added detailed steps to the testDetails section in the HTML report.
279
321
  - Introduced a new flaky icon for better visual representation in the report.
280
322
  - Display of test steps in the HTML report.
281
323
  - Added a filter for retry tests to better categorize and display them.
282
324
 
283
325
  **Improved:**
326
+
284
327
  - Updated the package dependencies to remove vulnerabilities.
285
328
  - Enhanced time formatting to include milliseconds in the duration display.
286
329
  - Enhanced the calculation and display of the success rate in the HTML report.
@@ -288,21 +331,25 @@ npx ortoni-report show-report
288
331
  ## Version 1.1.2
289
332
 
290
333
  **New Features:**
334
+
291
335
  - **Ellipsis Styling for Test Names:** Long test names are now truncated with ellipsis for better readability.
292
336
  - **Retry, Pass, Fail, and Skip Indicators:** Added visual indicators (images) to denote the status of each test, including retries.
293
337
  - **Enhanced `msToTime` Function:** Duration now includes milliseconds for more precise time tracking.
294
338
  - **Summary Filters:** Clicking on summary filters (passed, failed & other) to display the selected filter.
295
339
 
296
340
  **Improvements:**
341
+
297
342
  - **Unified Status Handling:** The `applyFilter` function now treats `failed` and `timedOut` statuses as the same for consistent filtering.
298
343
  - **Date and Time Formatting:** Passed date in the format `DD-MMM-YYYY` and included time for more detailed reporting.
299
344
  - **Success Rate and Last Run Data:** Added the ability to pass `successRate` and `lastRun` data to the `onEnd` method for comprehensive report details.
300
345
 
301
346
  **Bug Fixes:**
347
+
302
348
  - Fixed issues with conditionals in Handlebars for status checking.
303
349
  - Improved event listener attachment for filtering and search functionalities.
304
350
 
305
351
  **Notes:**
352
+
306
353
  - Screenshot handling has been enhanced with modal dialogs, using Pico.css for styling.
307
354
 
308
355
  This release includes several visual and functional enhancements aimed at improving the usability and readability of the Playwright test reports. The added features and improvements will help users better understand test outcomes and statuses at a glance.
@@ -310,27 +357,32 @@ This release includes several visual and functional enhancements aimed at improv
310
357
  ### Version 1.1.0
311
358
 
312
359
  ## New Features
360
+
313
361
  - **Search Functionality:**
314
362
  - Added a search bar to filter tests by their title.
315
363
  - Display the relevant test name, project, and test file name while hiding others during search.
316
364
  - Reset search form to show all tests when cleared.
317
365
 
318
- ## Improvements
366
+ ## Improvements
367
+
319
368
  - **Page Zoom:**
320
369
  - Set the HTML page zoom to 90% for better display on different screen sizes.
321
370
 
322
371
  ## Bug Fixes
372
+
323
373
  - **Event Listeners:**
324
374
  - Fixed an issue where test details would not display when clicking on filtered search results.
325
375
  - Ensured event listeners are correctly reattached after filtering search results.
326
376
 
327
377
  ## Style Adjustments
378
+
328
379
  - **CSS Adjustments:**
329
380
  - Adjusted body zoom for better overall display: `body { zoom: 0.9; }`
330
381
 
331
382
  ---
332
383
 
333
384
  ### Instructions for Users
385
+
334
386
  - Use the search bar to quickly find specific tests by their title.
335
387
  - Clear the search input to reset the view and display all tests.
336
388
  - Note that the page zoom has been set to 90% for optimal display.
@@ -338,6 +390,7 @@ This release includes several visual and functional enhancements aimed at improv
338
390
  ### Version 1.0.9
339
391
 
340
392
  **Added:**
393
+
341
394
  1. Added functionality to highlight selected test result in the list
342
395
  2. Implemented search functionality to filter test results based on user input
343
396
  3. Added reset functionality to display all tests when the search bar is cleared
@@ -348,14 +401,16 @@ This release includes several visual and functional enhancements aimed at improv
348
401
  8. Added flaky test (Retry results)
349
402
 
350
403
  **Fixed**
404
+
351
405
  1. File path based on unix/windows machine [ISSUE#1](https://github.com/ortoniKC/ortoni-report/issues/1)
352
406
  2. Log & Error message display where it shows the actual html element
353
407
  3. Skip test duration of 0s for the skipper test
354
408
  4. Fixed Absolute path of test files
355
409
 
356
410
  **Changed:**
411
+
357
412
  1. Modified the `displayTestDetails` function to remove highlights when displaying test details
358
413
  2. Updated the `searchTests` function to show all tests when the search query is empty
359
414
  3. Improved time format to HH:MM:SS
360
415
 
361
- These changes improve the user experience by allowing users to easily search for specific tests and providing visual feedback when selecting a test result from the list.
416
+ These changes improve the user experience by allowing users to easily search for specific tests and providing visual feedback when selecting a test result from the list.
@@ -0,0 +1,76 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
3
+ var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require : typeof Proxy !== "undefined" ? new Proxy(x, {
4
+ get: (a, b) => (typeof require !== "undefined" ? require : a)[b]
5
+ }) : x)(function(x) {
6
+ if (typeof require !== "undefined") return require.apply(this, arguments);
7
+ throw Error('Dynamic require of "' + x + '" is not supported');
8
+ });
9
+ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
10
+
11
+ // src/utils/expressServer.ts
12
+ import express from "express";
13
+ import path from "path";
14
+ import { spawn } from "child_process";
15
+ function startReportServer(reportFolder, reportFilename, port = 2004, open) {
16
+ const app = express();
17
+ app.use(express.static(reportFolder));
18
+ app.get("/", (_req, res) => {
19
+ try {
20
+ res.sendFile(path.resolve(reportFolder, reportFilename));
21
+ } catch (error) {
22
+ console.error("Ortoni-Report: Error sending report file:", error);
23
+ res.status(500).send("Error loading report");
24
+ }
25
+ });
26
+ try {
27
+ const server = app.listen(port, () => {
28
+ console.log(
29
+ `Server is running at http://localhost:${port}
30
+ Press Ctrl+C to stop.`
31
+ );
32
+ if (open === "always" || open === "on-failure") {
33
+ try {
34
+ openBrowser(`http://localhost:${port}`);
35
+ } catch (error) {
36
+ console.error("Ortoni-Report: Error opening browser:", error);
37
+ }
38
+ }
39
+ });
40
+ server.on("error", (error) => {
41
+ if (error.code === "EADDRINUSE") {
42
+ console.error(
43
+ `Ortoni-Report: Port ${port} is already in use. Trying a different port...`
44
+ );
45
+ } else {
46
+ console.error("Ortoni-Report: Server error:", error);
47
+ }
48
+ });
49
+ } catch (error) {
50
+ console.error("Ortoni-Report: Error starting the server:", error);
51
+ }
52
+ }
53
+ function openBrowser(url) {
54
+ const platform = process.platform;
55
+ let command;
56
+ try {
57
+ if (platform === "win32") {
58
+ command = "cmd";
59
+ spawn(command, ["/c", "start", url]);
60
+ } else if (platform === "darwin") {
61
+ command = "open";
62
+ spawn(command, [url]);
63
+ } else {
64
+ command = "xdg-open";
65
+ spawn(command, [url]);
66
+ }
67
+ } catch (error) {
68
+ console.error("Ortoni-Report: Error opening the browser:", error);
69
+ }
70
+ }
71
+
72
+ export {
73
+ __require,
74
+ __publicField,
75
+ startReportServer
76
+ };
@@ -0,0 +1,69 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
3
+ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
4
+
5
+ // src/utils/expressServer.ts
6
+ import express from "express";
7
+ import path from "path";
8
+ import { spawn } from "child_process";
9
+ function startReportServer(reportFolder, reportFilename, port = 2004, open) {
10
+ const app = express();
11
+ app.use(express.static(reportFolder));
12
+ app.get("/", (_req, res) => {
13
+ try {
14
+ res.sendFile(path.resolve(reportFolder, reportFilename));
15
+ } catch (error) {
16
+ console.error("Ortoni-Report: Error sending report file:", error);
17
+ res.status(500).send("Error loading report");
18
+ }
19
+ });
20
+ try {
21
+ const server = app.listen(port, () => {
22
+ console.log(
23
+ `Server is running at http://localhost:${port}
24
+ Press Ctrl+C to stop.`
25
+ );
26
+ if (open === "always" || open === "on-failure") {
27
+ try {
28
+ openBrowser(`http://localhost:${port}`);
29
+ } catch (error) {
30
+ console.error("Ortoni-Report: Error opening browser:", error);
31
+ }
32
+ }
33
+ });
34
+ server.on("error", (error) => {
35
+ if (error.code === "EADDRINUSE") {
36
+ console.error(
37
+ `Ortoni-Report: Port ${port} is already in use. Trying a different port...`
38
+ );
39
+ } else {
40
+ console.error("Ortoni-Report: Server error:", error);
41
+ }
42
+ });
43
+ } catch (error) {
44
+ console.error("Ortoni-Report: Error starting the server:", error);
45
+ }
46
+ }
47
+ function openBrowser(url) {
48
+ const platform = process.platform;
49
+ let command;
50
+ try {
51
+ if (platform === "win32") {
52
+ command = "cmd";
53
+ spawn(command, ["/c", "start", url]);
54
+ } else if (platform === "darwin") {
55
+ command = "open";
56
+ spawn(command, [url]);
57
+ } else {
58
+ command = "xdg-open";
59
+ spawn(command, [url]);
60
+ }
61
+ } catch (error) {
62
+ console.error("Ortoni-Report: Error opening the browser:", error);
63
+ }
64
+ }
65
+
66
+ export {
67
+ __publicField,
68
+ startReportServer
69
+ };
@@ -0,0 +1,72 @@
1
+ var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require : typeof Proxy !== "undefined" ? new Proxy(x, {
2
+ get: (a, b) => (typeof require !== "undefined" ? require : a)[b]
3
+ }) : x)(function(x) {
4
+ if (typeof require !== "undefined") return require.apply(this, arguments);
5
+ throw Error('Dynamic require of "' + x + '" is not supported');
6
+ });
7
+
8
+ // src/utils/expressServer.ts
9
+ import express from "express";
10
+ import path from "path";
11
+ import { spawn } from "child_process";
12
+ function startReportServer(reportFolder, reportFilename, port = 2004, open) {
13
+ const app = express();
14
+ app.use(express.static(reportFolder));
15
+ app.get("/", (_req, res) => {
16
+ try {
17
+ res.sendFile(path.resolve(reportFolder, reportFilename));
18
+ } catch (error) {
19
+ console.error("Ortoni-Report: Error sending report file:", error);
20
+ res.status(500).send("Error loading report");
21
+ }
22
+ });
23
+ try {
24
+ const server = app.listen(port, () => {
25
+ console.log(
26
+ `Server is running at http://localhost:${port}
27
+ Press Ctrl+C to stop.`
28
+ );
29
+ if (open === "always" || open === "on-failure") {
30
+ try {
31
+ openBrowser(`http://localhost:${port}`);
32
+ } catch (error) {
33
+ console.error("Ortoni-Report: Error opening browser:", error);
34
+ }
35
+ }
36
+ });
37
+ server.on("error", (error) => {
38
+ if (error.code === "EADDRINUSE") {
39
+ console.error(
40
+ `Ortoni-Report: Port ${port} is already in use. Trying a different port...`
41
+ );
42
+ } else {
43
+ console.error("Ortoni-Report: Server error:", error);
44
+ }
45
+ });
46
+ } catch (error) {
47
+ console.error("Ortoni-Report: Error starting the server:", error);
48
+ }
49
+ }
50
+ function openBrowser(url) {
51
+ const platform = process.platform;
52
+ let command;
53
+ try {
54
+ if (platform === "win32") {
55
+ command = "cmd";
56
+ spawn(command, ["/c", "start", url]);
57
+ } else if (platform === "darwin") {
58
+ command = "open";
59
+ spawn(command, [url]);
60
+ } else {
61
+ command = "xdg-open";
62
+ spawn(command, [url]);
63
+ }
64
+ } catch (error) {
65
+ console.error("Ortoni-Report: Error opening the browser:", error);
66
+ }
67
+ }
68
+
69
+ export {
70
+ __require,
71
+ startReportServer
72
+ };
package/dist/cli/cli.js CHANGED
@@ -43,8 +43,10 @@ function startReportServer(reportFolder, reportFilename, port = 2004, open) {
43
43
  });
44
44
  try {
45
45
  const server = app.listen(port, () => {
46
- console.log(`Server is running at http://localhost:${port}
47
- Press Ctrl+C to stop.`);
46
+ console.log(
47
+ `Server is running at http://localhost:${port}
48
+ Press Ctrl+C to stop.`
49
+ );
48
50
  if (open === "always" || open === "on-failure") {
49
51
  try {
50
52
  openBrowser(`http://localhost:${port}`);
@@ -55,7 +57,9 @@ Press Ctrl+C to stop.`);
55
57
  });
56
58
  server.on("error", (error) => {
57
59
  if (error.code === "EADDRINUSE") {
58
- console.error(`Ortoni-Report: Port ${port} is already in use. Trying a different port...`);
60
+ console.error(
61
+ `Ortoni-Report: Port ${port} is already in use. Trying a different port...`
62
+ );
59
63
  } else {
60
64
  console.error("Ortoni-Report: Server error:", error);
61
65
  }
package/dist/cli/cli.mjs CHANGED
@@ -1,7 +1,7 @@
1
1
  #!/usr/bin/env node
2
2
  import {
3
3
  startReportServer
4
- } from "../chunk-ZSIRUQUA.mjs";
4
+ } from "../chunk-A6HCKATU.mjs";
5
5
 
6
6
  // src/cli/cli.ts
7
7
  import { program } from "commander";
@@ -105,6 +105,7 @@ declare class OrtoniReport implements Reporter {
105
105
  private dbManager;
106
106
  private shouldGenerateReport;
107
107
  private showConsoleLogs;
108
+ private skipTraceViewer;
108
109
  constructor(ortoniConfig?: OrtoniReportConfig);
109
110
  private reportsCount;
110
111
  onBegin(config: FullConfig, _suite: Suite): Promise<void>;
@@ -105,6 +105,7 @@ declare class OrtoniReport implements Reporter {
105
105
  private dbManager;
106
106
  private shouldGenerateReport;
107
107
  private showConsoleLogs;
108
+ private skipTraceViewer;
108
109
  constructor(ortoniConfig?: OrtoniReportConfig);
109
110
  private reportsCount;
110
111
  onBegin(config: FullConfig, _suite: Suite): Promise<void>;