@wdio/junit-reporter 10.0.0-alpha.18 → 10.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/AGENTS.md +20 -0
- package/README.md +46 -19
- package/build/index.js +1 -1
- package/package.json +7 -7
package/AGENTS.md
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
# @wdio/junit-reporter
|
|
2
|
+
|
|
3
|
+
JUnit XML reporter. It extends `@wdio/reporter`. User docs are this package's `README.md`.
|
|
4
|
+
|
|
5
|
+
## Commands
|
|
6
|
+
|
|
7
|
+
```sh
|
|
8
|
+
pnpm run test:package wdio-junit-reporter
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
CJS `addProperty` load check: `pnpm --filter @wdio/test-interop-cjs run test:junit-reporter`.
|
|
12
|
+
|
|
13
|
+
## Test ownership
|
|
14
|
+
|
|
15
|
+
- JUnit XML shape (suites, failures, skips, Cucumber scenarios, BrowserStack package names, and file association) is owned by `tests/reporter.test.ts` through `_buildJunitXml`. Keep those snapshots. Do not stub the suite builders and assert the stub.
|
|
16
|
+
- `onRunnerEnd` must write the built report. Assert that document. A mocked `undefined` snapshot does not.
|
|
17
|
+
- Whitespace-stripped snapshots do not lock command-log spacing. Exact `COMMAND:` / `RESULT:` text stays on the stdout test.
|
|
18
|
+
- `addProperty` is the public worker API (process event `junit:addProperty`). Call `addProperty`, not the private listener.
|
|
19
|
+
- `addWorkerLogs` is owned by writing to `stdout` while a test is current, then restoring `stdout.write`.
|
|
20
|
+
- The CJS interop check uses `assert.equal(typeof fn, 'function')`. `assert(typeof fn, 'function')` cannot fail.
|
package/README.md
CHANGED
|
@@ -149,18 +149,23 @@ export const config = {
|
|
|
149
149
|
The following options are supported:
|
|
150
150
|
|
|
151
151
|
### outputDir
|
|
152
|
+
|
|
153
|
+
<Option type="String">
|
|
154
|
+
|
|
152
155
|
Define a directory where your XML files should get stored. Ignored if either `logFile` or `setLogFile` are defined.
|
|
153
156
|
|
|
154
|
-
|
|
157
|
+
</Option>
|
|
155
158
|
|
|
156
159
|
### outputFileFormat
|
|
160
|
+
|
|
161
|
+
<Option type="Object" default={`(opts) => \`wdio-\${opts.cid}-junit-reporter.log\``}>
|
|
162
|
+
|
|
157
163
|
Function for defining the filename format for the reporter log files. Ignored if either `logFile` or `setLogFile`
|
|
158
164
|
are defined.
|
|
159
165
|
|
|
160
166
|
The function accepts an object input parameter with the `cid` and `capabilities` keys.
|
|
161
167
|
|
|
162
|
-
|
|
163
|
-
Default: ``(opts) => `wdio-${opts.cid}-junit-reporter.log` ``<br />
|
|
168
|
+
</Option>
|
|
164
169
|
Example:
|
|
165
170
|
```js
|
|
166
171
|
// wdio.conf.js
|
|
@@ -175,10 +180,13 @@ export const config = {
|
|
|
175
180
|
```
|
|
176
181
|
|
|
177
182
|
### logFile
|
|
183
|
+
|
|
184
|
+
<Option type="String">
|
|
185
|
+
|
|
178
186
|
Path to the reporter log file relative to the current directory. Overrides `outputDir` and `outputFileFormat`.
|
|
179
187
|
Ignored if `setLogFile` is defined.
|
|
180
188
|
|
|
181
|
-
|
|
189
|
+
</Option>
|
|
182
190
|
Example:
|
|
183
191
|
```js
|
|
184
192
|
// wdio.conf.js
|
|
@@ -192,11 +200,14 @@ export const config = {
|
|
|
192
200
|
```
|
|
193
201
|
|
|
194
202
|
### setLogFile
|
|
203
|
+
|
|
204
|
+
<Option type="Object">
|
|
205
|
+
|
|
195
206
|
Function for defining the path for the reporter log files. Overrides `outputDir`, `outputFileFormat`, and `logFile`.
|
|
196
207
|
|
|
197
208
|
The function accepts two input parameters: `cid` and `name` (the reporter name, set to `junit`).
|
|
198
209
|
|
|
199
|
-
|
|
210
|
+
</Option>
|
|
200
211
|
Example:
|
|
201
212
|
```js
|
|
202
213
|
// wdio.conf.js
|
|
@@ -210,25 +221,32 @@ export const config = {
|
|
|
210
221
|
```
|
|
211
222
|
|
|
212
223
|
### stdout
|
|
224
|
+
|
|
225
|
+
<Option type="boolean" default="false">
|
|
226
|
+
|
|
213
227
|
Output the generated XML to the console instead of creating a log file.
|
|
214
228
|
|
|
215
|
-
|
|
216
|
-
Default: `false`
|
|
229
|
+
</Option>
|
|
217
230
|
|
|
218
231
|
### writeStream
|
|
232
|
+
|
|
233
|
+
<Option type="WriteStream">
|
|
234
|
+
|
|
219
235
|
Set a stream to which the generated XML should be output, instead of creating a log file.
|
|
220
236
|
|
|
221
237
|
Note: `logFile` must not be set, unless `stdout` is set to `true`.
|
|
222
238
|
|
|
223
|
-
|
|
239
|
+
</Option>
|
|
224
240
|
|
|
225
241
|
### suiteNameFormat
|
|
242
|
+
|
|
243
|
+
<Option type="Regex | Object" default="/[^a-zA-Z0-9@]+/">
|
|
244
|
+
|
|
226
245
|
Format the generated name of a test suite, using custom regex or a function.
|
|
227
246
|
|
|
228
247
|
The function accepts an object input parameter with the `name` and `suite` keys.
|
|
229
248
|
|
|
230
|
-
|
|
231
|
-
Default: `/[^a-zA-Z0-9@]+/`<br />
|
|
249
|
+
</Option>
|
|
232
250
|
Example with Regex:
|
|
233
251
|
```js
|
|
234
252
|
// wdio.conf.js
|
|
@@ -255,12 +273,15 @@ export const config = {
|
|
|
255
273
|
```
|
|
256
274
|
|
|
257
275
|
### classNameFormat
|
|
276
|
+
|
|
277
|
+
<Option type="Object">
|
|
278
|
+
|
|
258
279
|
Format the generated classname of a test case.
|
|
259
280
|
|
|
260
281
|
The function accepts an object input parameter with the [`packageName`](#packagename), `activeFeatureName`
|
|
261
282
|
(Cucumber only), and `suite` (non-Cucumber only) keys.
|
|
262
283
|
|
|
263
|
-
|
|
284
|
+
</Option>
|
|
264
285
|
Default (Cucumber): ``(opts) => `${opts.packageName}${opts.activeFeatureName}` ``<br />
|
|
265
286
|
Default (others): ``(opts) => `${opts.packageName}.${(opts.suite.fullTitle || opts.suite.title).replace(/\s/g, '_')}` ``<br />
|
|
266
287
|
Example (Cucumber):
|
|
@@ -288,14 +309,14 @@ export const config = {
|
|
|
288
309
|
};
|
|
289
310
|
```
|
|
290
311
|
|
|
291
|
-
|
|
292
312
|
### addFileAttribute
|
|
293
313
|
|
|
314
|
+
<Option type="Boolean" default="false">
|
|
315
|
+
|
|
294
316
|
Adds a `file` attribute to each testcase. The value of this attribute matches the filepath property of the parent test
|
|
295
317
|
suite. This config is primarily for CircleCI, but may break on other CI platforms.
|
|
296
318
|
|
|
297
|
-
|
|
298
|
-
Default: `false`<br />
|
|
319
|
+
</Option>
|
|
299
320
|
Example simplified XML:
|
|
300
321
|
```xml
|
|
301
322
|
<testsuite>
|
|
@@ -310,9 +331,11 @@ Example simplified XML:
|
|
|
310
331
|
|
|
311
332
|
### packageName
|
|
312
333
|
|
|
334
|
+
<Option type="String">
|
|
335
|
+
|
|
313
336
|
You can break out packages by an additional level by setting `'packageName'`. For example, if you wanted to iterate over a test suite with a different environment variable set:
|
|
314
337
|
|
|
315
|
-
|
|
338
|
+
</Option>
|
|
316
339
|
Default (Cucumber): `CucumberJUnitReport-${sanitizedCapabilities}`<br />
|
|
317
340
|
Default (others): `${sanitizedCapabilities}`<br />
|
|
318
341
|
Example:
|
|
@@ -331,6 +354,8 @@ export const config = {
|
|
|
331
354
|
|
|
332
355
|
### errorOptions
|
|
333
356
|
|
|
357
|
+
<Option type="Object" default={`errorOptions: { error: "message" }`}>
|
|
358
|
+
|
|
334
359
|
Allows to set various combinations of error notifications inside xml.<br />
|
|
335
360
|
Given a Jasmine test like `expect(true).toBe(false, 'my custom message')` you will get this test error:
|
|
336
361
|
|
|
@@ -347,8 +372,7 @@ Given a Jasmine test like `expect(true).toBe(false, 'my custom message')` you wi
|
|
|
347
372
|
|
|
348
373
|
Therefore you can choose *which* key will be used *where*, see the example below.
|
|
349
374
|
|
|
350
|
-
|
|
351
|
-
Default: `errorOptions: { error: "message" }`<br />
|
|
375
|
+
</Option>
|
|
352
376
|
Example:
|
|
353
377
|
|
|
354
378
|
```js
|
|
@@ -369,10 +393,11 @@ export const config = {
|
|
|
369
393
|
|
|
370
394
|
### addWorkerLogs
|
|
371
395
|
|
|
396
|
+
<Option type="Boolean" default="false">
|
|
397
|
+
|
|
372
398
|
Attach console logs from the test in the reporter.
|
|
373
399
|
|
|
374
|
-
|
|
375
|
-
Default: `false`<br />
|
|
400
|
+
</Option>
|
|
376
401
|
Example:
|
|
377
402
|
|
|
378
403
|
```js
|
|
@@ -426,3 +451,5 @@ If there is no such post-build step in your CI system, there is probably a plugi
|
|
|
426
451
|
----
|
|
427
452
|
|
|
428
453
|
For more information on WebdriverIO see the [homepage](https://webdriver.io).
|
|
454
|
+
|
|
455
|
+
|
package/build/index.js
CHANGED
|
@@ -331,7 +331,7 @@ ${stepsOutput}
|
|
|
331
331
|
this._addAmbiguousBasenameSuites(builder, runner, isCucumberFrameworkRunner, assignedSuiteKeys);
|
|
332
332
|
return builder.build();
|
|
333
333
|
}
|
|
334
|
-
_buildOrderedReport(builder, runner, specFileName, type, isCucumberFrameworkRunner, assignedSuiteKeys
|
|
334
|
+
_buildOrderedReport(builder, runner, specFileName, type, isCucumberFrameworkRunner, assignedSuiteKeys) {
|
|
335
335
|
const suiteKeys = Object.keys(this.suites);
|
|
336
336
|
if (suiteKeys.length === 0) {
|
|
337
337
|
if (!isCucumberFrameworkRunner || isCucumberFrameworkRunner && type === "feature") {
|
package/package.json
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wdio/junit-reporter",
|
|
3
|
-
"version": "10.0.
|
|
3
|
+
"version": "10.0.1",
|
|
4
4
|
"description": "A WebdriverIO reporter that creates Jenkins compatible XML based JUnit reports",
|
|
5
5
|
"author": "Christian Bromann <mail@bromann.dev>",
|
|
6
6
|
"homepage": "https://github.com/webdriverio/webdriverio/tree/main/packages/wdio-junit-reporter",
|
|
7
7
|
"license": "MIT",
|
|
8
8
|
"engines": {
|
|
9
|
-
"node": ">=
|
|
9
|
+
"node": ">=22.19.0"
|
|
10
10
|
},
|
|
11
11
|
"repository": {
|
|
12
12
|
"type": "git",
|
|
@@ -33,12 +33,12 @@
|
|
|
33
33
|
"require": "./build/index.cjs"
|
|
34
34
|
}
|
|
35
35
|
},
|
|
36
|
-
"typeScriptVersion": "
|
|
36
|
+
"typeScriptVersion": "6.0.3",
|
|
37
37
|
"dependencies": {
|
|
38
|
-
"@wdio/reporter": "10.0.
|
|
39
|
-
"@wdio/types": "10.0.
|
|
38
|
+
"@wdio/reporter": "10.0.1",
|
|
39
|
+
"@wdio/types": "10.0.1",
|
|
40
40
|
"json-stringify-safe": "^5.0.1",
|
|
41
|
-
"junit-report-builder": "^5.1.
|
|
41
|
+
"junit-report-builder": "^5.1.2"
|
|
42
42
|
},
|
|
43
43
|
"devDependencies": {
|
|
44
44
|
"@types/json-stringify-safe": "^5.0.0"
|
|
@@ -46,5 +46,5 @@
|
|
|
46
46
|
"publishConfig": {
|
|
47
47
|
"access": "public"
|
|
48
48
|
},
|
|
49
|
-
"gitHead": "
|
|
49
|
+
"gitHead": "e7b4a3eaf3990c4b93af901777cab3ebd08a633b"
|
|
50
50
|
}
|