monocart-reporter 2.9.5 → 2.9.7

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/lib/index.d.ts CHANGED
@@ -1,268 +1,268 @@
1
- import type { TestInfo } from "@playwright/test"
2
- import type {
3
- CoverageReportOptions,
4
- ReportDescription,
5
- V8CoverageEntry,
6
- Watermarks,
7
- CoverageResults,
8
- CoverageSummary,
9
- MetricsSummary,
10
- CoverageFile,
11
- CoverageRange,
12
- AddedResults
13
- } from "monocart-coverage-reports";
14
-
15
- export type {
16
- TestInfo,
17
-
18
- CoverageReportOptions,
19
- ReportDescription,
20
- V8CoverageEntry,
21
- Watermarks,
22
- CoverageResults,
23
- CoverageSummary,
24
- MetricsSummary,
25
- CoverageFile,
26
- CoverageRange,
27
- AddedResults
28
- }
29
-
30
- export interface Helper {
31
-
32
- find: (callback: ((item: any, parent: any) => void)) => any;
33
- filter: (callback: ((item: any, parent: any) => void)) => any[];
34
- /** Traverse all cases, suites, and steps. */
35
- forEach: (callback: ((item: any, parent: any) => void | "break")) => void;
36
-
37
- /** send email with nodemailer: https://nodemailer.com/ */
38
- sendEmail: (emailOptions: {
39
- /** email transport: https://nodemailer.com/smtp/ */
40
- transport: any;
41
- /** email message: https://nodemailer.com/message/ */
42
- message: any;
43
- }) => Promise<void>;
44
-
45
- }
46
-
47
- export type MonocartReporterOptions = {
48
- /** logging levels: off, error, info, debug */
49
- logging?: string;
50
-
51
- /** the report name */
52
- name?: string;
53
-
54
- /** the output file path (relative process.cwd) */
55
- outputFile?: string;
56
-
57
- /** output json file for data only */
58
- json?: boolean;
59
-
60
- /** output zip file for all report files
61
- * {boolean} using default path
62
- * {string} zip file path
63
- */
64
- zip?: boolean | string | {
65
- /** the zip file path */
66
- outputFile?: string;
67
- /** whether to clean the files after zipped */
68
- clean?: boolean;
69
- };
70
-
71
- /**
72
- * whether to copy attachments to the reporter output dir, defaults to true
73
- * it is useful when there are multiple html reports being output
74
- */
75
- copyAttachments?: boolean;
76
-
77
- /** attachment path handler, for example:
78
- * ```js
79
- * attachmentPath: (currentPath, extras) => `https://cenfun.github.io/monocart-reporter/${currentPath}`
80
- * ```
81
- */
82
- attachmentPath?: (currentPath: string, extras: any) => string;
83
-
84
- /** custom trace viewer url: https://github.com/cenfun/monocart-reporter?#view-trace-online */
85
- traceViewerUrl?: string;
86
-
87
- /** timezone offset in minutes, For example: GMT+0800 = -480 */
88
- timezoneOffset?: number;
89
-
90
- /** normal or exclude-idle */
91
- durationStrategy?: 'normal' | 'exclude-idle',
92
-
93
- /** global coverage options: https://github.com/cenfun/monocart-reporter?#code-coverage-report
94
- * ```js
95
- * coverage: {
96
- * entryFilter: (entry) => true,
97
- * sourceFilter: (sourcePath) => sourcePath.search(/src\/.+/) !== -1,
98
- * }
99
- * ```
100
- */
101
- coverage?: CoverageReportOptions;
102
-
103
- /** Global State Management: https://github.com/cenfun/monocart-reporter?#global-state-management */
104
- state?: {
105
- data?: any;
106
- server?: {
107
- host?: string;
108
- port?: number;
109
- }
110
- onReceive?: (...args: any[]) => any;
111
- onClose?: (data: any, config: any) => void;
112
- },
113
-
114
- /** trend data handler: https://github.com/cenfun/monocart-reporter?#trend-chart
115
- * ```js
116
- * trend: () => './monocart-report/index.json'
117
- * ```
118
- */
119
- trend?: string | (() => Promise<string | any>);
120
-
121
- /** custom tags style: https://github.com/cenfun/monocart-reporter?#style-tags
122
- * ```js
123
- * tags: {
124
- * smoke: {
125
- * 'background': '#6F9913'
126
- * },
127
- * sanity: {
128
- * 'background': '#178F43'
129
- * }
130
- * }
131
- * ```
132
- */
133
- tags?: {
134
- [key: string]: any;
135
- };
136
-
137
- /** columns data handler: https://github.com/cenfun/monocart-reporter?#style-tags */
138
- columns?: (defaultColumns: any[]) => void;
139
-
140
- /** rows data handler (suite, case and step) https://github.com/cenfun/monocart-reporter?#custom-data-visitor */
141
- visitor?: (data: any, metadata: any) => void;
142
-
143
- /** enable/disable custom fields in comments. Defaults to true. */
144
- customFieldsInComments?: boolean;
145
-
146
- /** mermaid options */
147
- mermaid?: {
148
- /** mermaid script url, for example: https://cdn.jsdelivr.net/npm/mermaid@latest/dist/mermaid.min.js */
149
- scriptSrc?: string;
150
- /** mermaid config: https://mermaid.js.org/config/schema-docs/config.html */
151
- config?: any;
152
- }
153
-
154
- /** enable/disable group or levels */
155
- groupOptions?: {
156
- group?: boolean;
157
-
158
- shard?: boolean;
159
- project?: boolean;
160
- file?: boolean;
161
- describe?: boolean;
162
- step?: boolean;
163
-
164
- merge?: boolean;
165
- }
166
-
167
- /**
168
- * onData hook
169
- */
170
- onData?: (reportData: any, rawData: any) => Promise<void>;
171
-
172
-
173
- /** onEnd hook: https://github.com/cenfun/monocart-reporter?#onend-hook */
174
- onEnd?: (reportData: any, helper: Helper) => Promise<void>;
175
-
176
- }
177
-
178
- /**
179
- * merge
180
- */
181
- export function merge(
182
- reportDataList: any[],
183
- options?: MonocartReporterOptions
184
- ): Promise<void>;
185
-
186
- /**
187
- * audit
188
- */
189
- export type AuditReportOptions = {
190
- title?: string;
191
- outputDir?: string;
192
- outputName?: string;
193
- };
194
-
195
- export function attachAuditReport(
196
- runnerResult: any,
197
- testInfo: TestInfo,
198
- options?: AuditReportOptions
199
- ): Promise<any>;
200
-
201
-
202
- /**
203
- * coverage
204
- */
205
-
206
- export function addCoverageReport(
207
- coverageData: any[] | any,
208
- testInfo: TestInfo
209
- ): Promise<AddedResults>;
210
-
211
- export function attachCoverageReport(
212
- coverageData: any[] | any,
213
- testInfo: TestInfo,
214
- options?: CoverageReportOptions
215
- ): Promise<CoverageResults>;
216
-
217
-
218
- /**
219
- * network
220
- */
221
- export type NetworkReportOptions = {
222
- title?: string;
223
- outputDir?: string;
224
- outputName?: string;
225
-
226
- // Whether inline all scripts to the single HTML file.
227
- inline?: boolean;
228
- };
229
-
230
- export function attachNetworkReport(
231
- har: string | Buffer,
232
- testInfo: TestInfo,
233
- options?: NetworkReportOptions
234
- ): Promise<any>;
235
-
236
- export function setMetadata(
237
- data: {
238
- [key: string]: any;
239
- },
240
- testInfo: TestInfo
241
- ): void;
242
-
243
- /**
244
- * state
245
- */
246
- export type StateOptions = {
247
- host?: string;
248
- port?: number;
249
- timeout?: number;
250
- };
251
-
252
- export type State = {
253
- get: {
254
- (key: string): Promise<any>,
255
- (...args: string[]): Promise<any[]>
256
- },
257
- set: {
258
- (key: string, value: any): Promise<void>,
259
- (obj: any): Promise<void>
260
- },
261
- remove: {
262
- (key: string): Promise<void>,
263
- (...args: string[]): Promise<void>
264
- },
265
- send: (...args: any[]) => Promise<any>
266
- }
267
-
268
- export function useState(options?: StateOptions): State;
1
+ import type { TestInfo } from "@playwright/test"
2
+ import type {
3
+ CoverageReportOptions,
4
+ ReportDescription,
5
+ V8CoverageEntry,
6
+ Watermarks,
7
+ CoverageResults,
8
+ CoverageSummary,
9
+ MetricsSummary,
10
+ CoverageFile,
11
+ CoverageRange,
12
+ AddedResults
13
+ } from "monocart-coverage-reports";
14
+
15
+ export type {
16
+ TestInfo,
17
+
18
+ CoverageReportOptions,
19
+ ReportDescription,
20
+ V8CoverageEntry,
21
+ Watermarks,
22
+ CoverageResults,
23
+ CoverageSummary,
24
+ MetricsSummary,
25
+ CoverageFile,
26
+ CoverageRange,
27
+ AddedResults
28
+ }
29
+
30
+ export interface Helper {
31
+
32
+ find: (callback: ((item: any, parent: any) => void)) => any;
33
+ filter: (callback: ((item: any, parent: any) => void)) => any[];
34
+ /** Traverse all cases, suites, and steps. */
35
+ forEach: (callback: ((item: any, parent: any) => void | "break")) => void;
36
+
37
+ /** send email with nodemailer: https://nodemailer.com/ */
38
+ sendEmail: (emailOptions: {
39
+ /** email transport: https://nodemailer.com/smtp/ */
40
+ transport: any;
41
+ /** email message: https://nodemailer.com/message/ */
42
+ message: any;
43
+ }) => Promise<void>;
44
+
45
+ }
46
+
47
+ export type MonocartReporterOptions = {
48
+ /** logging levels: off, error, info, debug */
49
+ logging?: string;
50
+
51
+ /** the report name */
52
+ name?: string;
53
+
54
+ /** the output file path (relative process.cwd) */
55
+ outputFile?: string;
56
+
57
+ /** output json file for data only */
58
+ json?: boolean;
59
+
60
+ /** output zip file for all report files
61
+ * {boolean} using default path
62
+ * {string} zip file path
63
+ */
64
+ zip?: boolean | string | {
65
+ /** the zip file path */
66
+ outputFile?: string;
67
+ /** whether to clean the files after zipped */
68
+ clean?: boolean;
69
+ };
70
+
71
+ /**
72
+ * whether to copy attachments to the reporter output dir, defaults to true
73
+ * it is useful when there are multiple html reports being output
74
+ */
75
+ copyAttachments?: boolean;
76
+
77
+ /** attachment path handler, for example:
78
+ * ```js
79
+ * attachmentPath: (currentPath, extras) => `https://cenfun.github.io/monocart-reporter/${currentPath}`
80
+ * ```
81
+ */
82
+ attachmentPath?: (currentPath: string, extras: any) => string;
83
+
84
+ /** custom trace viewer url: https://github.com/cenfun/monocart-reporter?#view-trace-online */
85
+ traceViewerUrl?: string;
86
+
87
+ /** timezone offset in minutes, For example: GMT+0800 = -480 */
88
+ timezoneOffset?: number;
89
+
90
+ /** normal or exclude-idle */
91
+ durationStrategy?: 'normal' | 'exclude-idle',
92
+
93
+ /** global coverage options: https://github.com/cenfun/monocart-reporter?#code-coverage-report
94
+ * ```js
95
+ * coverage: {
96
+ * entryFilter: (entry) => true,
97
+ * sourceFilter: (sourcePath) => sourcePath.search(/src\/.+/) !== -1,
98
+ * }
99
+ * ```
100
+ */
101
+ coverage?: CoverageReportOptions;
102
+
103
+ /** Global State Management: https://github.com/cenfun/monocart-reporter?#global-state-management */
104
+ state?: {
105
+ data?: any;
106
+ server?: {
107
+ host?: string;
108
+ port?: number;
109
+ }
110
+ onReceive?: (...args: any[]) => any;
111
+ onClose?: (data: any, config: any) => void;
112
+ },
113
+
114
+ /** trend data handler: https://github.com/cenfun/monocart-reporter?#trend-chart
115
+ * ```js
116
+ * trend: () => './monocart-report/index.json'
117
+ * ```
118
+ */
119
+ trend?: string | (() => Promise<string | any>);
120
+
121
+ /** custom tags style: https://github.com/cenfun/monocart-reporter?#style-tags
122
+ * ```js
123
+ * tags: {
124
+ * smoke: {
125
+ * 'background': '#6F9913'
126
+ * },
127
+ * sanity: {
128
+ * 'background': '#178F43'
129
+ * }
130
+ * }
131
+ * ```
132
+ */
133
+ tags?: {
134
+ [key: string]: any;
135
+ };
136
+
137
+ /** columns data handler: https://github.com/cenfun/monocart-reporter?#style-tags */
138
+ columns?: (defaultColumns: any[]) => void;
139
+
140
+ /** rows data handler (suite, case and step) https://github.com/cenfun/monocart-reporter?#custom-data-visitor */
141
+ visitor?: (data: any, metadata: any) => void;
142
+
143
+ /** enable/disable custom fields in comments. Defaults to true. */
144
+ customFieldsInComments?: boolean;
145
+
146
+ /** mermaid options */
147
+ mermaid?: {
148
+ /** mermaid script url, for example: https://cdn.jsdelivr.net/npm/mermaid@latest/dist/mermaid.min.js */
149
+ scriptSrc?: string;
150
+ /** mermaid config: https://mermaid.js.org/config/schema-docs/config.html */
151
+ config?: any;
152
+ }
153
+
154
+ /** enable/disable group or levels */
155
+ groupOptions?: {
156
+ group?: boolean;
157
+
158
+ shard?: boolean;
159
+ project?: boolean;
160
+ file?: boolean;
161
+ describe?: boolean;
162
+ step?: boolean;
163
+
164
+ merge?: boolean;
165
+ }
166
+
167
+ /**
168
+ * onData hook
169
+ */
170
+ onData?: (reportData: any, rawData: any) => Promise<void>;
171
+
172
+
173
+ /** onEnd hook: https://github.com/cenfun/monocart-reporter?#onend-hook */
174
+ onEnd?: (reportData: any, helper: Helper) => Promise<void>;
175
+
176
+ }
177
+
178
+ /**
179
+ * merge
180
+ */
181
+ export function merge(
182
+ reportDataList: any[],
183
+ options?: MonocartReporterOptions
184
+ ): Promise<void>;
185
+
186
+ /**
187
+ * audit
188
+ */
189
+ export type AuditReportOptions = {
190
+ title?: string;
191
+ outputDir?: string;
192
+ outputName?: string;
193
+ };
194
+
195
+ export function attachAuditReport(
196
+ runnerResult: any,
197
+ testInfo: TestInfo,
198
+ options?: AuditReportOptions
199
+ ): Promise<any>;
200
+
201
+
202
+ /**
203
+ * coverage
204
+ */
205
+
206
+ export function addCoverageReport(
207
+ coverageData: any[] | any,
208
+ testInfo: TestInfo
209
+ ): Promise<AddedResults>;
210
+
211
+ export function attachCoverageReport(
212
+ coverageData: any[] | any,
213
+ testInfo: TestInfo,
214
+ options?: CoverageReportOptions
215
+ ): Promise<CoverageResults>;
216
+
217
+
218
+ /**
219
+ * network
220
+ */
221
+ export type NetworkReportOptions = {
222
+ title?: string;
223
+ outputDir?: string;
224
+ outputName?: string;
225
+
226
+ // Whether inline all scripts to the single HTML file.
227
+ inline?: boolean;
228
+ };
229
+
230
+ export function attachNetworkReport(
231
+ har: string | Buffer,
232
+ testInfo: TestInfo,
233
+ options?: NetworkReportOptions
234
+ ): Promise<any>;
235
+
236
+ export function setMetadata(
237
+ data: {
238
+ [key: string]: any;
239
+ },
240
+ testInfo: TestInfo
241
+ ): void;
242
+
243
+ /**
244
+ * state
245
+ */
246
+ export type StateOptions = {
247
+ host?: string;
248
+ port?: number;
249
+ timeout?: number;
250
+ };
251
+
252
+ export type State = {
253
+ get: {
254
+ (key: string): Promise<any>,
255
+ (...args: string[]): Promise<any[]>
256
+ },
257
+ set: {
258
+ (key: string, value: any): Promise<void>,
259
+ (obj: any): Promise<void>
260
+ },
261
+ remove: {
262
+ (key: string): Promise<void>,
263
+ (...args: string[]): Promise<void>
264
+ },
265
+ send: (...args: any[]) => Promise<any>
266
+ }
267
+
268
+ export function useState(options?: StateOptions): State;