monocart-reporter 2.0.0 → 2.0.2
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/generate-report.js +3 -3
- package/lib/index.d.ts +78 -3
- package/lib/packages/monocart-network.js +1 -1
- package/lib/packages/monocart-reporter.js +1 -1
- package/lib/packages/monocart-vendor.js +12 -12
- package/lib/plugins/coverage/coverage.js +24 -17
- package/lib/plugins/network/network.js +3 -3
- package/lib/utils/util.js +28 -0
- package/package.json +3 -3
package/lib/generate-report.js
CHANGED
|
@@ -19,11 +19,11 @@ const generateHtml = async (outputDir, htmlFile, reportData, inline) => {
|
|
|
19
19
|
|
|
20
20
|
// deps
|
|
21
21
|
const jsFiles = ['turbogrid'].map((it) => {
|
|
22
|
-
return
|
|
22
|
+
return Util.resolveNodeModule(`${it}/dist/${it}.js`);
|
|
23
23
|
});
|
|
24
24
|
|
|
25
|
-
jsFiles.push(
|
|
26
|
-
jsFiles.push(
|
|
25
|
+
jsFiles.push(Util.resolvePackage('monocart-common.js'));
|
|
26
|
+
jsFiles.push(Util.resolvePackage('monocart-reporter.js'));
|
|
27
27
|
|
|
28
28
|
const options = {
|
|
29
29
|
inline,
|
package/lib/index.d.ts
CHANGED
|
@@ -1,13 +1,87 @@
|
|
|
1
1
|
import { TestInfo } from "@playwright/test"
|
|
2
2
|
|
|
3
3
|
import type { CoverageReportOptions } from "monocart-coverage-reports";
|
|
4
|
+
export * from 'monocart-coverage-reports';
|
|
5
|
+
|
|
6
|
+
export type MonocartReporterOptions = {
|
|
7
|
+
// the report name
|
|
8
|
+
name?: string,
|
|
9
|
+
|
|
10
|
+
// the output file path (relative process.cwd)
|
|
11
|
+
outputFile?: string,
|
|
12
|
+
|
|
13
|
+
// attachment path handler
|
|
14
|
+
attachmentPath?: (currentPath: string, extras: any) => string,
|
|
15
|
+
// attachmentPath: (currentPath, extras) => `https://cenfun.github.io/monocart-reporter/${currentPath}`,
|
|
16
|
+
|
|
17
|
+
traceViewerUrl?: string,
|
|
18
|
+
|
|
19
|
+
// logging levels: off, error, info, debug
|
|
20
|
+
logging?: string,
|
|
21
|
+
|
|
22
|
+
// timezone offset in minutes, GMT+0800 = -480
|
|
23
|
+
timezoneOffset?: number,
|
|
24
|
+
|
|
25
|
+
// global coverage settings for addCoverageReport API
|
|
26
|
+
coverage?: CoverageReportOptions,
|
|
27
|
+
// coverage: {
|
|
28
|
+
// entryFilter: (entry) => true,
|
|
29
|
+
// sourceFilter: (sourcePath) => sourcePath.search(/src\/.+/) !== -1,
|
|
30
|
+
// },
|
|
31
|
+
|
|
32
|
+
state?: {
|
|
33
|
+
data?: any,
|
|
34
|
+
server?: {
|
|
35
|
+
host?: string,
|
|
36
|
+
port?: number
|
|
37
|
+
}
|
|
38
|
+
onReceive?: (...args: any[]) => any,
|
|
39
|
+
onClose?: (data: any, config: any) => void
|
|
40
|
+
},
|
|
41
|
+
|
|
42
|
+
// trend data handler
|
|
43
|
+
trend?: string | (() => Promise<string | object>),
|
|
44
|
+
// trend: () => './test-results/report.json',
|
|
45
|
+
|
|
46
|
+
// custom tags style
|
|
47
|
+
tags?: object,
|
|
48
|
+
// tags: {
|
|
49
|
+
// smoke: {
|
|
50
|
+
// 'background': '#6F9913'
|
|
51
|
+
// },
|
|
52
|
+
// sanity: {
|
|
53
|
+
// 'background': '#178F43'
|
|
54
|
+
// }
|
|
55
|
+
// },
|
|
56
|
+
|
|
57
|
+
// columns data handler
|
|
58
|
+
columns?: (defaultColumns: object[]) => void,
|
|
59
|
+
// columns: (defaultColumns) => {},
|
|
60
|
+
|
|
61
|
+
// rows data handler (suite, case and step)
|
|
62
|
+
visitor?: (data: any, metadata: any, collect: {
|
|
63
|
+
//ParserOptions https://github.com/babel/babel/blob/main/packages/babel-parser/typings/babel-parser.d.ts
|
|
64
|
+
comments?: (parserOptions: any) => void
|
|
65
|
+
}) => void,
|
|
66
|
+
// visitor: (data, metadata, collect) => {},
|
|
67
|
+
|
|
68
|
+
// onEnd hook
|
|
69
|
+
onEnd?: (reportData: object, capability: {
|
|
70
|
+
sendEmail?: (emailOptions: {
|
|
71
|
+
transport: object,
|
|
72
|
+
message: object
|
|
73
|
+
}) => Promise<void>,
|
|
74
|
+
forEach?: (callback: ((item: any) => void)) => void
|
|
75
|
+
}) => Promise<void>
|
|
76
|
+
// onEnd: async (reportData, capability) => {}
|
|
77
|
+
}
|
|
4
78
|
|
|
5
79
|
/**
|
|
6
80
|
* merge
|
|
7
81
|
*/
|
|
8
82
|
export function merge(
|
|
9
|
-
reportDataList: [],
|
|
10
|
-
options?:
|
|
83
|
+
reportDataList: any[],
|
|
84
|
+
options?: MonocartReporterOptions
|
|
11
85
|
): Promise<void>;
|
|
12
86
|
|
|
13
87
|
/**
|
|
@@ -29,6 +103,7 @@ export function attachAuditReport(
|
|
|
29
103
|
/**
|
|
30
104
|
* coverage
|
|
31
105
|
*/
|
|
106
|
+
|
|
32
107
|
export function addCoverageReport(
|
|
33
108
|
coverageData: any[] | any,
|
|
34
109
|
testInfo: TestInfo
|
|
@@ -85,4 +160,4 @@ export type State = {
|
|
|
85
160
|
send: (...args: any[]) => Promise<any>
|
|
86
161
|
}
|
|
87
162
|
|
|
88
|
-
export function useState(options?: StateOptions): State;
|
|
163
|
+
export function useState(options?: StateOptions): State;
|