reporting-labs 0.1.0
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/LICENSE +21 -0
- package/README.md +247 -0
- package/bin/cli.js +32 -0
- package/dist/index.d.ts +5 -0
- package/dist/index.js +15 -0
- package/dist/mask.d.ts +9 -0
- package/dist/mask.js +51 -0
- package/dist/meta.d.ts +43 -0
- package/dist/meta.js +70 -0
- package/dist/reporter.d.ts +37 -0
- package/dist/reporter.js +504 -0
- package/dist/template.d.ts +4 -0
- package/dist/template.js +1383 -0
- package/dist/types.d.ts +281 -0
- package/dist/types.js +2 -0
- package/fonts/mono-400.woff2 +0 -0
- package/fonts/mono-500.woff2 +0 -0
- package/fonts/sans-400.woff2 +0 -0
- package/fonts/sans-500.woff2 +0 -0
- package/fonts/sans-600.woff2 +0 -0
- package/package.json +69 -0
package/dist/types.d.ts
ADDED
|
@@ -0,0 +1,281 @@
|
|
|
1
|
+
export interface ReportingLabsOptions {
|
|
2
|
+
/** Report title shown in the header. Default: "Test report" */
|
|
3
|
+
title?: string;
|
|
4
|
+
/** Path or data-URI of a logo image. Optional. */
|
|
5
|
+
logo?: string;
|
|
6
|
+
/** Override the palette accent with your brand color, e.g. '#7C3AED'. Default: the palette's own accent (royal blue for `lab`). */
|
|
7
|
+
accent?: string;
|
|
8
|
+
/** Color theme. Default: "auto" (follows OS) */
|
|
9
|
+
theme?: 'auto' | 'light' | 'dark';
|
|
10
|
+
/** Color palette. Default: "lab" (blue + white). Viewers can switch in the header. */
|
|
11
|
+
palette?: 'lab' | 'ocean' | 'ember' | 'mono';
|
|
12
|
+
/** Output folder for the report and copied attachments. Default: "reporting-labs" */
|
|
13
|
+
outputFolder?: string;
|
|
14
|
+
/** Output HTML file name inside outputFolder. Default: "index.html" */
|
|
15
|
+
outputFile?: string;
|
|
16
|
+
/** Inline screenshots as base64 (single file, opens anywhere). Default: true */
|
|
17
|
+
embedAttachments?: boolean;
|
|
18
|
+
/** Max size (bytes) of a single attachment to embed. Larger ones are copied as files. Default: 2 MB */
|
|
19
|
+
embedLimit?: number;
|
|
20
|
+
/** Inline videos as base64 too (makes the file big). Default: false – videos are copied to ./assets */
|
|
21
|
+
embedVideos?: boolean;
|
|
22
|
+
/** Key/value shown in the header (env, branch, build...). `build` labels the run in the history; when it is not set the CI run number is used. */
|
|
23
|
+
metadata?: Record<string, string>;
|
|
24
|
+
/** Extra sections rendered below the summary. HTML is allowed. */
|
|
25
|
+
sections?: Array<{
|
|
26
|
+
title: string;
|
|
27
|
+
html: string;
|
|
28
|
+
}>;
|
|
29
|
+
/** Hide widgets you don't need. */
|
|
30
|
+
widgets?: {
|
|
31
|
+
runStrip?: boolean;
|
|
32
|
+
outcome?: boolean;
|
|
33
|
+
attention?: boolean;
|
|
34
|
+
dimensions?: boolean;
|
|
35
|
+
timeline?: boolean;
|
|
36
|
+
durations?: boolean;
|
|
37
|
+
tags?: boolean;
|
|
38
|
+
slowest?: boolean;
|
|
39
|
+
projects?: boolean;
|
|
40
|
+
/** Flakiest tests over the run history. Default: true */
|
|
41
|
+
flaky?: boolean;
|
|
42
|
+
/** Environment card (Playwright, Node, OS, browsers, CI, commit). Default: true */
|
|
43
|
+
environment?: boolean;
|
|
44
|
+
/** Skipped tests with their reasons. Default: true */
|
|
45
|
+
skipped?: boolean;
|
|
46
|
+
};
|
|
47
|
+
/**
|
|
48
|
+
* Annotation/tag keys treated as chart dimensions (priority, severity, owner...).
|
|
49
|
+
* Set via meta({ priority: 'P1' }) in tests, annotations, or tags like @priority:P1 / @P1.
|
|
50
|
+
* Default: ['priority', 'severity', 'feature', 'owner']
|
|
51
|
+
*/
|
|
52
|
+
dimensions?: string[];
|
|
53
|
+
/** Custom value order for a dimension, e.g. { severity: ['blocker','critical','major','minor'] } */
|
|
54
|
+
dimensionOrder?: Record<string, string[]>;
|
|
55
|
+
/** Extra CSS appended to the report. */
|
|
56
|
+
customCss?: string;
|
|
57
|
+
/** Embed IBM Plex Sans/Mono in the HTML (~140 KB) so the report looks the same everywhere, offline. Default: true */
|
|
58
|
+
embedFonts?: boolean;
|
|
59
|
+
/** Print report path to the console after the run. Default: true */
|
|
60
|
+
announce?: boolean;
|
|
61
|
+
/** Company / project block in the header. */
|
|
62
|
+
project?: {
|
|
63
|
+
name?: string;
|
|
64
|
+
version?: string;
|
|
65
|
+
url?: string;
|
|
66
|
+
description?: string;
|
|
67
|
+
team?: string;
|
|
68
|
+
};
|
|
69
|
+
/**
|
|
70
|
+
* Turn meta values into links. Key = meta key (story, epic, ticket, issue, jira...), value = URL template with {id}.
|
|
71
|
+
* e.g. { story: 'https://acme.atlassian.net/browse/{id}', epic: 'https://acme.atlassian.net/browse/{id}' }
|
|
72
|
+
*/
|
|
73
|
+
links?: Record<string, string>;
|
|
74
|
+
/** Keys (case-insensitive substrings) whose values are masked in test data and API panels. */
|
|
75
|
+
maskKeys?: string[];
|
|
76
|
+
/** Keep a rolling run history next to the report and draw a trend chart. Per-test outcomes are stored too, which powers new-vs-known failures, flaky history and duration regressions. */
|
|
77
|
+
history?: {
|
|
78
|
+
enabled?: boolean;
|
|
79
|
+
file?: string;
|
|
80
|
+
keep?: number;
|
|
81
|
+
};
|
|
82
|
+
/** Extra rows for the Environment card, e.g. { 'App version': '2.4.0', 'Test data': 'staging-seed-12' }. Values that are URLs become links. */
|
|
83
|
+
env?: Record<string, string>;
|
|
84
|
+
/** Show an "Open in VS Code" link on every test (vscode://file/...). Default: true locally, false when the CI env var is set. */
|
|
85
|
+
editorLinks?: boolean;
|
|
86
|
+
/** Style Given/When/Then steps as Gherkin and label describe blocks as Features/Scenarios. Default: auto-detect */
|
|
87
|
+
bdd?: boolean;
|
|
88
|
+
}
|
|
89
|
+
/** Lets you type a known value and still accept any string. */
|
|
90
|
+
export type Loose<T extends string> = T | (string & {});
|
|
91
|
+
/**
|
|
92
|
+
* Metadata for one test. Known keys get charts, filters and links in the report;
|
|
93
|
+
* any extra key is allowed and shows as a chip on the test.
|
|
94
|
+
* Extend the known keys for your team via module augmentation:
|
|
95
|
+
*
|
|
96
|
+
* declare module 'reporting-labs' { interface CustomMeta { team?: 'web' | 'mobile' } }
|
|
97
|
+
*/
|
|
98
|
+
export interface TestMeta extends CustomMeta {
|
|
99
|
+
/** Business priority. P0 = must never break, P3 = nice to have. Drives "Needs attention" ranking. */
|
|
100
|
+
priority?: Loose<'P0' | 'P1' | 'P2' | 'P3' | 'P4'>;
|
|
101
|
+
/** Impact if this fails. */
|
|
102
|
+
severity?: Loose<'blocker' | 'critical' | 'major' | 'minor' | 'trivial'>;
|
|
103
|
+
/** Person or team who owns this test. */
|
|
104
|
+
owner?: string;
|
|
105
|
+
/** Feature / module under test, e.g. 'checkout'. */
|
|
106
|
+
feature?: string;
|
|
107
|
+
/** Epic key, e.g. 'EPIC-18'. Becomes a link when `links.epic` is configured. */
|
|
108
|
+
epic?: string;
|
|
109
|
+
/** User story key, e.g. 'SHOP-250'. Becomes a link when `links.story` is configured. */
|
|
110
|
+
story?: string;
|
|
111
|
+
/** Bug / issue key this test guards against, e.g. 'PROMO-118'. */
|
|
112
|
+
issue?: string;
|
|
113
|
+
/** Test case id in your TCM tool (TestRail, Xray, Zephyr...). */
|
|
114
|
+
testCaseId?: string;
|
|
115
|
+
/** Free-form tags or any other key you like. */
|
|
116
|
+
[key: string]: string | number | undefined;
|
|
117
|
+
}
|
|
118
|
+
/** Empty by default; augment it to add typed keys of your own. */
|
|
119
|
+
export interface CustomMeta {
|
|
120
|
+
}
|
|
121
|
+
export interface ApiCall {
|
|
122
|
+
/** HTTP method. */
|
|
123
|
+
method: Loose<'GET' | 'POST' | 'PUT' | 'PATCH' | 'DELETE' | 'HEAD' | 'OPTIONS'>;
|
|
124
|
+
url: string;
|
|
125
|
+
status?: number;
|
|
126
|
+
duration?: number;
|
|
127
|
+
requestHeaders?: Record<string, string>;
|
|
128
|
+
requestBody?: unknown;
|
|
129
|
+
responseHeaders?: Record<string, string>;
|
|
130
|
+
responseBody?: unknown;
|
|
131
|
+
name?: string;
|
|
132
|
+
}
|
|
133
|
+
export interface HistoryEntry {
|
|
134
|
+
time: number;
|
|
135
|
+
duration: number;
|
|
136
|
+
passed: number;
|
|
137
|
+
failed: number;
|
|
138
|
+
flaky: number;
|
|
139
|
+
skipped: number;
|
|
140
|
+
total: number;
|
|
141
|
+
label?: string;
|
|
142
|
+
/** Per-test outcome and last-attempt duration, keyed by TestData.key. Codes: p passed, f failed, k flaky, s skipped. */
|
|
143
|
+
tests?: Record<string, [string, number]>;
|
|
144
|
+
}
|
|
145
|
+
export interface EnvRow {
|
|
146
|
+
k: string;
|
|
147
|
+
v: string;
|
|
148
|
+
href?: string;
|
|
149
|
+
}
|
|
150
|
+
export type Status = 'passed' | 'failed' | 'skipped' | 'flaky' | 'timedOut' | 'interrupted';
|
|
151
|
+
export interface ErrorData {
|
|
152
|
+
message: string;
|
|
153
|
+
stack?: string;
|
|
154
|
+
snippet?: string;
|
|
155
|
+
location?: {
|
|
156
|
+
file: string;
|
|
157
|
+
line: number;
|
|
158
|
+
column: number;
|
|
159
|
+
};
|
|
160
|
+
}
|
|
161
|
+
export interface StepData {
|
|
162
|
+
title: string;
|
|
163
|
+
category: string;
|
|
164
|
+
duration: number;
|
|
165
|
+
error?: string;
|
|
166
|
+
steps: StepData[];
|
|
167
|
+
}
|
|
168
|
+
export interface AttachmentData {
|
|
169
|
+
name: string;
|
|
170
|
+
contentType: string;
|
|
171
|
+
/** data URI (embedded) or relative path (copied) */
|
|
172
|
+
src?: string;
|
|
173
|
+
/** small inline text bodies (stdout, json) */
|
|
174
|
+
text?: string;
|
|
175
|
+
/** bytes on disk, when known */
|
|
176
|
+
size?: number;
|
|
177
|
+
}
|
|
178
|
+
export interface ResultData {
|
|
179
|
+
retry: number;
|
|
180
|
+
status: string;
|
|
181
|
+
duration: number;
|
|
182
|
+
startTime: number;
|
|
183
|
+
workerIndex: number;
|
|
184
|
+
errors: ErrorData[];
|
|
185
|
+
steps: StepData[];
|
|
186
|
+
attachments: AttachmentData[];
|
|
187
|
+
stdout: string[];
|
|
188
|
+
stderr: string[];
|
|
189
|
+
logs: {
|
|
190
|
+
t: number;
|
|
191
|
+
msg: string;
|
|
192
|
+
}[];
|
|
193
|
+
data: {
|
|
194
|
+
name: string;
|
|
195
|
+
kind: 'table' | 'kv' | 'text';
|
|
196
|
+
columns?: string[];
|
|
197
|
+
rows?: string[][];
|
|
198
|
+
kv?: [string, string][];
|
|
199
|
+
text?: string;
|
|
200
|
+
}[];
|
|
201
|
+
api: ApiCall[];
|
|
202
|
+
}
|
|
203
|
+
export interface TestData {
|
|
204
|
+
id: string;
|
|
205
|
+
/** Stable identity across runs: project, file and full title. Used to match history entries. */
|
|
206
|
+
key: string;
|
|
207
|
+
title: string;
|
|
208
|
+
/** describe blocks, outermost first */
|
|
209
|
+
path: string[];
|
|
210
|
+
file: string;
|
|
211
|
+
line: number;
|
|
212
|
+
project: string;
|
|
213
|
+
tags: string[];
|
|
214
|
+
annotations: {
|
|
215
|
+
type: string;
|
|
216
|
+
description?: string;
|
|
217
|
+
}[];
|
|
218
|
+
/** extracted dimension values, e.g. { priority: 'P1', severity: 'critical' } */
|
|
219
|
+
meta: Record<string, string>;
|
|
220
|
+
outcome: Status;
|
|
221
|
+
duration: number;
|
|
222
|
+
results: ResultData[];
|
|
223
|
+
/** Playwright's expected status: 'failed' for test.fail(), 'skipped' for fixme/skip. */
|
|
224
|
+
expectedStatus?: string;
|
|
225
|
+
/** True when the test is marked test.fail() and failed as expected (counted as passed). */
|
|
226
|
+
expectedFailure?: boolean;
|
|
227
|
+
/** Explains an outcome that has no error of its own, e.g. a test.fail() test that unexpectedly passed. */
|
|
228
|
+
note?: string;
|
|
229
|
+
timeout?: number;
|
|
230
|
+
retries?: number;
|
|
231
|
+
column?: number;
|
|
232
|
+
}
|
|
233
|
+
export interface ReportData {
|
|
234
|
+
title: string;
|
|
235
|
+
generatedAt: number;
|
|
236
|
+
startTime: number;
|
|
237
|
+
duration: number;
|
|
238
|
+
metadata: Record<string, string>;
|
|
239
|
+
projects: string[];
|
|
240
|
+
workers: number;
|
|
241
|
+
stats: Record<Status, number> & {
|
|
242
|
+
total: number;
|
|
243
|
+
};
|
|
244
|
+
tests: TestData[];
|
|
245
|
+
history: HistoryEntry[];
|
|
246
|
+
bdd: boolean;
|
|
247
|
+
/** Directory the config lives in; test files are relative to it. */
|
|
248
|
+
rootDir: string;
|
|
249
|
+
env: EnvRow[];
|
|
250
|
+
/** Overall run status from Playwright: interrupted (Ctrl+C) or timedout (globalTimeout) mean tests did not finish. */
|
|
251
|
+
runStatus: 'passed' | 'failed' | 'timedout' | 'interrupted';
|
|
252
|
+
/** Errors reported outside any test: spec files that failed to load, global setup, worker crashes. */
|
|
253
|
+
globalErrors: ErrorData[];
|
|
254
|
+
/** Console output that was not attributed to a test. */
|
|
255
|
+
globalOutput: {
|
|
256
|
+
stream: 'out' | 'err';
|
|
257
|
+
text: string;
|
|
258
|
+
}[];
|
|
259
|
+
shard?: {
|
|
260
|
+
current: number;
|
|
261
|
+
total: number;
|
|
262
|
+
};
|
|
263
|
+
options: {
|
|
264
|
+
logo?: string;
|
|
265
|
+
accent?: string;
|
|
266
|
+
theme: 'auto' | 'light' | 'dark';
|
|
267
|
+
palette: 'lab' | 'ocean' | 'ember' | 'mono';
|
|
268
|
+
embedFonts: boolean;
|
|
269
|
+
sections: Array<{
|
|
270
|
+
title: string;
|
|
271
|
+
html: string;
|
|
272
|
+
}>;
|
|
273
|
+
widgets: Required<NonNullable<ReportingLabsOptions['widgets']>>;
|
|
274
|
+
dimensions: string[];
|
|
275
|
+
dimensionOrder: Record<string, string[]>;
|
|
276
|
+
project?: ReportingLabsOptions['project'];
|
|
277
|
+
links: Record<string, string>;
|
|
278
|
+
customCss: string;
|
|
279
|
+
editorLinks: boolean;
|
|
280
|
+
};
|
|
281
|
+
}
|
package/dist/types.js
ADDED
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
package/package.json
ADDED
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "reporting-labs",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "reportingLabs \u2013 beautiful, customizable single-file HTML test reports. One line of config. Playwright adapter included, more runners on the way.",
|
|
5
|
+
"keywords": [
|
|
6
|
+
"test-report",
|
|
7
|
+
"html-report",
|
|
8
|
+
"reporter",
|
|
9
|
+
"testing",
|
|
10
|
+
"qa",
|
|
11
|
+
"test-automation",
|
|
12
|
+
"playwright",
|
|
13
|
+
"dashboard"
|
|
14
|
+
],
|
|
15
|
+
"author": "Naveen Khunteta <naveen@naveenautomationlabs.com>",
|
|
16
|
+
"license": "MIT",
|
|
17
|
+
"type": "commonjs",
|
|
18
|
+
"main": "dist/index.js",
|
|
19
|
+
"types": "dist/index.d.ts",
|
|
20
|
+
"exports": {
|
|
21
|
+
".": {
|
|
22
|
+
"types": "./dist/index.d.ts",
|
|
23
|
+
"default": "./dist/index.js"
|
|
24
|
+
},
|
|
25
|
+
"./playwright": {
|
|
26
|
+
"types": "./dist/index.d.ts",
|
|
27
|
+
"default": "./dist/index.js"
|
|
28
|
+
}
|
|
29
|
+
},
|
|
30
|
+
"bin": {
|
|
31
|
+
"reporting-labs": "bin/cli.js",
|
|
32
|
+
"rlabs": "bin/cli.js"
|
|
33
|
+
},
|
|
34
|
+
"files": [
|
|
35
|
+
"dist",
|
|
36
|
+
"bin",
|
|
37
|
+
"fonts",
|
|
38
|
+
"README.md",
|
|
39
|
+
"LICENSE"
|
|
40
|
+
],
|
|
41
|
+
"scripts": {
|
|
42
|
+
"build": "tsc -p tsconfig.json",
|
|
43
|
+
"demo": "npm run build && cd example && npx playwright test; cd .. && echo 'open example/reporting-labs/index.html'",
|
|
44
|
+
"prepublishOnly": "npm run build",
|
|
45
|
+
"pack:check": "npm run build && npm pack --dry-run"
|
|
46
|
+
},
|
|
47
|
+
"peerDependencies": {
|
|
48
|
+
"@playwright/test": ">=1.40.0"
|
|
49
|
+
},
|
|
50
|
+
"devDependencies": {
|
|
51
|
+
"@fontsource/ibm-plex-mono": "^5.3.0",
|
|
52
|
+
"@fontsource/ibm-plex-sans": "^5.3.0",
|
|
53
|
+
"@playwright/test": "^1.63.0",
|
|
54
|
+
"@types/node": "^22.0.0",
|
|
55
|
+
"jsdom": "^30.1.0",
|
|
56
|
+
"typescript": "^5.6.0"
|
|
57
|
+
},
|
|
58
|
+
"repository": {
|
|
59
|
+
"type": "git",
|
|
60
|
+
"url": "git+https://github.com/naveenanimation20/reporting-labs.git"
|
|
61
|
+
},
|
|
62
|
+
"homepage": "https://github.com/naveenanimation20/reporting-labs#readme",
|
|
63
|
+
"bugs": {
|
|
64
|
+
"url": "https://github.com/naveenanimation20/reporting-labs/issues"
|
|
65
|
+
},
|
|
66
|
+
"engines": {
|
|
67
|
+
"node": ">=18"
|
|
68
|
+
}
|
|
69
|
+
}
|