@wdio/junit-reporter 9.32.0-alpha.6 → 9.32.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/build/index.d.ts +18 -0
- package/build/index.d.ts.map +1 -1
- package/build/index.js +82 -10
- package/package.json +4 -4
package/build/index.d.ts
CHANGED
|
@@ -38,9 +38,27 @@ declare class JunitReporter extends WDIOReporter {
|
|
|
38
38
|
private _addSuiteToBuilder;
|
|
39
39
|
private _buildJunitXml;
|
|
40
40
|
private _buildOrderedReport;
|
|
41
|
+
/**
|
|
42
|
+
* Emit filename-only suites that matched more than one grouped spec. They
|
|
43
|
+
* still belong in the report (issue #13052) but must not inherit the first
|
|
44
|
+
* spec's full path.
|
|
45
|
+
*/
|
|
46
|
+
private _addAmbiguousBasenameSuites;
|
|
41
47
|
private _getStandardOutput;
|
|
42
48
|
private _getCommandStandardOutput;
|
|
43
49
|
private _format;
|
|
50
|
+
private _toFilePath;
|
|
51
|
+
private _isBasenameOnly;
|
|
52
|
+
private _fileNamesEqual;
|
|
53
|
+
private _matchingSpecCount;
|
|
54
|
+
/**
|
|
55
|
+
* Decide whether a suite can be tied to a specific runner spec.
|
|
56
|
+
* - unique: full path match, or a filename-only Jasmine suite whose
|
|
57
|
+
* basename appears once in runner.specs
|
|
58
|
+
* - ambiguous: filename-only suite that matches multiple grouped specs
|
|
59
|
+
* - none: not the same file
|
|
60
|
+
*/
|
|
61
|
+
private _suiteFileAssociation;
|
|
44
62
|
private _sameFileName;
|
|
45
63
|
}
|
|
46
64
|
export * from './common/api.js';
|
package/build/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,WAAW,EAAc,SAAS,EAAE,MAAM,gBA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AAC,qBAAqB;IAoB7B,OAAO,CAAC,aAAa;CAuBxB;AAED,cAAc,iBAAiB,CAAA;AAC/B,eAAe,aAAa,CAAA"}
|
package/build/index.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
// src/index.ts
|
|
2
|
+
import path from "node:path";
|
|
2
3
|
import url from "node:url";
|
|
3
4
|
import os from "node:os";
|
|
4
5
|
import WDIOReporter from "@wdio/reporter";
|
|
@@ -318,17 +319,19 @@ ${stepsOutput}
|
|
|
318
319
|
this._suiteTitleLabel = "suiteName";
|
|
319
320
|
this._fileNameLabel = "file";
|
|
320
321
|
}
|
|
322
|
+
const assignedSuiteKeys = /* @__PURE__ */ new Set();
|
|
321
323
|
runner.specs.forEach((specFileName) => {
|
|
322
324
|
if (isCucumberFrameworkRunner) {
|
|
323
|
-
this._buildOrderedReport(builder, runner, specFileName, "feature", isCucumberFrameworkRunner);
|
|
324
|
-
this._buildOrderedReport(builder, runner, specFileName, "scenario", isCucumberFrameworkRunner);
|
|
325
|
+
this._buildOrderedReport(builder, runner, specFileName, "feature", isCucumberFrameworkRunner, assignedSuiteKeys);
|
|
326
|
+
this._buildOrderedReport(builder, runner, specFileName, "scenario", isCucumberFrameworkRunner, assignedSuiteKeys);
|
|
325
327
|
} else {
|
|
326
|
-
this._buildOrderedReport(builder, runner, specFileName, "", isCucumberFrameworkRunner);
|
|
328
|
+
this._buildOrderedReport(builder, runner, specFileName, "", isCucumberFrameworkRunner, assignedSuiteKeys);
|
|
327
329
|
}
|
|
328
330
|
});
|
|
331
|
+
this._addAmbiguousBasenameSuites(builder, runner, isCucumberFrameworkRunner, assignedSuiteKeys);
|
|
329
332
|
return builder.build();
|
|
330
333
|
}
|
|
331
|
-
_buildOrderedReport(builder, runner, specFileName, type, isCucumberFrameworkRunner) {
|
|
334
|
+
_buildOrderedReport(builder, runner, specFileName, type, isCucumberFrameworkRunner, assignedSuiteKeys = /* @__PURE__ */ new Set()) {
|
|
332
335
|
const suiteKeys = Object.keys(this.suites);
|
|
333
336
|
if (suiteKeys.length === 0) {
|
|
334
337
|
if (!isCucumberFrameworkRunner || isCucumberFrameworkRunner && type === "feature") {
|
|
@@ -343,16 +346,48 @@ ${stepsOutput}
|
|
|
343
346
|
if (suiteKey.match(/^"before all"/)) {
|
|
344
347
|
continue;
|
|
345
348
|
}
|
|
349
|
+
if (assignedSuiteKeys.has(suiteKey)) {
|
|
350
|
+
continue;
|
|
351
|
+
}
|
|
346
352
|
const suite = this.suites[suiteKey];
|
|
347
|
-
|
|
348
|
-
|
|
353
|
+
if (this._suiteFileAssociation(specFileName, suite.file, runner?.specs) !== "unique") {
|
|
354
|
+
continue;
|
|
355
|
+
}
|
|
356
|
+
if (isCucumberFrameworkRunner && suite.type === type) {
|
|
357
|
+
assignedSuiteKeys.add(suiteKey);
|
|
349
358
|
builder = this._addCucumberFeatureToBuilder(builder, runner, specFileName, suite);
|
|
350
|
-
} else if (!isCucumberFrameworkRunner
|
|
359
|
+
} else if (!isCucumberFrameworkRunner) {
|
|
360
|
+
assignedSuiteKeys.add(suiteKey);
|
|
351
361
|
builder = this._addSuiteToBuilder(builder, runner, specFileName, suite);
|
|
352
362
|
}
|
|
353
363
|
}
|
|
354
364
|
return builder;
|
|
355
365
|
}
|
|
366
|
+
/**
|
|
367
|
+
* Emit filename-only suites that matched more than one grouped spec. They
|
|
368
|
+
* still belong in the report (issue #13052) but must not inherit the first
|
|
369
|
+
* spec's full path.
|
|
370
|
+
*/
|
|
371
|
+
_addAmbiguousBasenameSuites(builder, runner, isCucumberFrameworkRunner, assignedSuiteKeys) {
|
|
372
|
+
const types = isCucumberFrameworkRunner ? ["feature", "scenario"] : [""];
|
|
373
|
+
for (const type of types) {
|
|
374
|
+
for (const suiteKey of Object.keys(this.suites)) {
|
|
375
|
+
if (suiteKey.match(/^"before all"/) || assignedSuiteKeys.has(suiteKey)) {
|
|
376
|
+
continue;
|
|
377
|
+
}
|
|
378
|
+
const suite = this.suites[suiteKey];
|
|
379
|
+
if (isCucumberFrameworkRunner && suite.type !== type) {
|
|
380
|
+
continue;
|
|
381
|
+
}
|
|
382
|
+
if (!suite.file || !this._isBasenameOnly(this._toFilePath(suite.file)) || this._matchingSpecCount(suite.file, runner.specs) <= 1) {
|
|
383
|
+
continue;
|
|
384
|
+
}
|
|
385
|
+
assignedSuiteKeys.add(suiteKey);
|
|
386
|
+
builder = isCucumberFrameworkRunner ? this._addCucumberFeatureToBuilder(builder, runner, suite.file, suite) : this._addSuiteToBuilder(builder, runner, suite.file, suite);
|
|
387
|
+
}
|
|
388
|
+
}
|
|
389
|
+
return builder;
|
|
390
|
+
}
|
|
356
391
|
_getStandardOutput(test) {
|
|
357
392
|
let consoleOutput = "";
|
|
358
393
|
if (this._addWorkerLogs) {
|
|
@@ -388,6 +423,39 @@ ${stepsOutput}
|
|
|
388
423
|
_format(val) {
|
|
389
424
|
return JSON.stringify(limit(val));
|
|
390
425
|
}
|
|
426
|
+
_toFilePath(file) {
|
|
427
|
+
return file.startsWith("file://") ? url.fileURLToPath(file) : file;
|
|
428
|
+
}
|
|
429
|
+
_isBasenameOnly(file) {
|
|
430
|
+
return !file.includes("/") && !file.includes("\\");
|
|
431
|
+
}
|
|
432
|
+
_fileNamesEqual(file1, file2) {
|
|
433
|
+
return file1.localeCompare(file2, void 0, { sensitivity: this._isWindows ? "accent" : "variant" }) === 0;
|
|
434
|
+
}
|
|
435
|
+
_matchingSpecCount(suiteFile, runnerSpecs) {
|
|
436
|
+
const suiteBase = path.basename(this._toFilePath(suiteFile));
|
|
437
|
+
return runnerSpecs.filter((spec) => this._fileNamesEqual(path.basename(this._toFilePath(spec)), suiteBase)).length;
|
|
438
|
+
}
|
|
439
|
+
/**
|
|
440
|
+
* Decide whether a suite can be tied to a specific runner spec.
|
|
441
|
+
* - unique: full path match, or a filename-only Jasmine suite whose
|
|
442
|
+
* basename appears once in runner.specs
|
|
443
|
+
* - ambiguous: filename-only suite that matches multiple grouped specs
|
|
444
|
+
* - none: not the same file
|
|
445
|
+
*/
|
|
446
|
+
_suiteFileAssociation(specFileName, suiteFile, runnerSpecs = []) {
|
|
447
|
+
if (!this._sameFileName(specFileName, suiteFile)) {
|
|
448
|
+
return "none";
|
|
449
|
+
}
|
|
450
|
+
if (!suiteFile) {
|
|
451
|
+
return "unique";
|
|
452
|
+
}
|
|
453
|
+
const suitePath = this._toFilePath(suiteFile);
|
|
454
|
+
if (!this._isBasenameOnly(suitePath)) {
|
|
455
|
+
return "unique";
|
|
456
|
+
}
|
|
457
|
+
return this._matchingSpecCount(suiteFile, runnerSpecs) > 1 ? "ambiguous" : "unique";
|
|
458
|
+
}
|
|
391
459
|
_sameFileName(file1, file2) {
|
|
392
460
|
if (!file1 && !file2) {
|
|
393
461
|
return true;
|
|
@@ -395,9 +463,13 @@ ${stepsOutput}
|
|
|
395
463
|
if (!file1 || !file2) {
|
|
396
464
|
return false;
|
|
397
465
|
}
|
|
398
|
-
file1 =
|
|
399
|
-
file2 =
|
|
400
|
-
|
|
466
|
+
file1 = this._toFilePath(file1);
|
|
467
|
+
file2 = this._toFilePath(file2);
|
|
468
|
+
if (this._isBasenameOnly(file1) || this._isBasenameOnly(file2)) {
|
|
469
|
+
file1 = path.basename(file1);
|
|
470
|
+
file2 = path.basename(file2);
|
|
471
|
+
}
|
|
472
|
+
return this._fileNamesEqual(file1, file2);
|
|
401
473
|
}
|
|
402
474
|
};
|
|
403
475
|
var index_default = JunitReporter;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wdio/junit-reporter",
|
|
3
|
-
"version": "9.32.0
|
|
3
|
+
"version": "9.32.0",
|
|
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",
|
|
@@ -35,8 +35,8 @@
|
|
|
35
35
|
},
|
|
36
36
|
"typeScriptVersion": "3.8.3",
|
|
37
37
|
"dependencies": {
|
|
38
|
-
"@wdio/reporter": "9.32.0
|
|
39
|
-
"@wdio/types": "9.32.0
|
|
38
|
+
"@wdio/reporter": "9.32.0",
|
|
39
|
+
"@wdio/types": "9.32.0",
|
|
40
40
|
"json-stringify-safe": "^5.0.1",
|
|
41
41
|
"junit-report-builder": "^5.1.1"
|
|
42
42
|
},
|
|
@@ -46,5 +46,5 @@
|
|
|
46
46
|
"publishConfig": {
|
|
47
47
|
"access": "public"
|
|
48
48
|
},
|
|
49
|
-
"gitHead": "
|
|
49
|
+
"gitHead": "5c2a318d9a5e8424a2f2de95df9374b89bda7936"
|
|
50
50
|
}
|