@wdio/junit-reporter 7.1.1 → 7.1.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/build/index.d.ts CHANGED
@@ -21,6 +21,7 @@ declare class JunitReporter extends WDIOReporter {
21
21
  private _addCucumberFeatureToBuilder;
22
22
  private _addSuiteToBuilder;
23
23
  private _buildJunitXml;
24
+ private _buildOrderedReport;
24
25
  private _getStandardOutput;
25
26
  private _format;
26
27
  }
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,OAAO,YAAY,EAAE,EAAc,WAAW,EAAa,MAAM,gBAAgB,CAAA;AAGjF,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,SAAS,CAAA;AAEnD;;;;;GAKG;AACH,cAAM,aAAc,SAAQ,YAAY;IAQhB,OAAO,EAAE,oBAAoB;IAPjD,OAAO,CAAC,eAAe,CAAQ;IAC/B,OAAO,CAAC,YAAY,CAAC,CAAQ;IAC7B,OAAO,CAAC,gBAAgB,CAAC,CAAQ;IACjC,OAAO,CAAC,cAAc,CAAC,CAAQ;IAC/B,OAAO,CAAC,cAAc,CAAC,CAAK;IAC5B,OAAO,CAAC,kBAAkB,CAAC,CAAK;gBAEZ,OAAO,EAAE,oBAAoB;IAOjD,WAAW,CAAE,MAAM,EAAE,WAAW;IAKhC,OAAO,CAAC,YAAY;IAMpB,OAAO,CAAC,eAAe;IAkBvB,OAAO,CAAC,4BAA4B;IA8EpC,OAAO,CAAC,kBAAkB;IA6D1B,OAAO,CAAC,cAAc;IAoDtB,OAAO,CAAC,kBAAkB;IAoB1B,OAAO,CAAC,OAAO;CAGlB;AAED,eAAe,aAAa,CAAA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,OAAO,YAAY,EAAE,EAAc,WAAW,EAAa,MAAM,gBAAgB,CAAA;AAGjF,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,SAAS,CAAA;AAEnD;;;;;GAKG;AACH,cAAM,aAAc,SAAQ,YAAY;IAQhB,OAAO,EAAE,oBAAoB;IAPjD,OAAO,CAAC,eAAe,CAAQ;IAC/B,OAAO,CAAC,YAAY,CAAC,CAAQ;IAC7B,OAAO,CAAC,gBAAgB,CAAC,CAAQ;IACjC,OAAO,CAAC,cAAc,CAAC,CAAQ;IAC/B,OAAO,CAAC,cAAc,CAAC,CAAK;IAC5B,OAAO,CAAC,kBAAkB,CAAC,CAAK;gBAEZ,OAAO,EAAE,oBAAoB;IAOjD,WAAW,CAAE,MAAM,EAAE,WAAW;IAKhC,OAAO,CAAC,YAAY;IAMpB,OAAO,CAAC,eAAe;IAkBvB,OAAO,CAAC,4BAA4B;IA+EpC,OAAO,CAAC,kBAAkB;IA8D1B,OAAO,CAAC,cAAc;IAyCtB,OAAO,CAAC,mBAAmB;IAmB3B,OAAO,CAAC,kBAAkB;IAoB1B,OAAO,CAAC,OAAO;CAGlB;AAED,eAAe,aAAa,CAAA"}
package/build/index.js CHANGED
@@ -64,7 +64,7 @@ class JunitReporter extends reporter_1.default {
64
64
  const testName = this._prepareName(suite.title);
65
65
  const testCase = this._activeFeature.testCase()
66
66
  .className(`${this._packageName}.${this._activeFeatureName}`)
67
- .name(`${this._activeFeatureName}.${testName}`)
67
+ .name(`${testName}`)
68
68
  .time(scenario._duration / 1000);
69
69
  if (this.options.addFileAttribute) {
70
70
  testCase.file(filePath);
@@ -103,6 +103,7 @@ class JunitReporter extends reporter_1.default {
103
103
  else {
104
104
  testCase.error();
105
105
  }
106
+ testCase.failure();
106
107
  isFailing = true;
107
108
  stepEmoji = '❗';
108
109
  }
@@ -158,6 +159,7 @@ class JunitReporter extends reporter_1.default {
158
159
  else {
159
160
  testCase.error();
160
161
  }
162
+ testCase.failure();
161
163
  }
162
164
  const output = this._getStandardOutput(test);
163
165
  if (output)
@@ -194,6 +196,18 @@ class JunitReporter extends reporter_1.default {
194
196
  this._suiteTitleLabel = 'suiteName';
195
197
  this._fileNameLabel = 'file';
196
198
  }
199
+ // there should only be one spec file per runner so we can safely take the first element of the array
200
+ const specFileName = runner.specs[0];
201
+ if (isCucumberFrameworkRunner) {
202
+ this._buildOrderedReport(builder, runner, specFileName, 'feature', isCucumberFrameworkRunner);
203
+ this._buildOrderedReport(builder, runner, specFileName, 'scenario', isCucumberFrameworkRunner);
204
+ }
205
+ else {
206
+ this._buildOrderedReport(builder, runner, specFileName, '', isCucumberFrameworkRunner);
207
+ }
208
+ return builder.build();
209
+ }
210
+ _buildOrderedReport(builder, runner, specFileName, type, isCucumberFrameworkRunner) {
197
211
  for (let suiteKey of Object.keys(this.suites)) {
198
212
  /**
199
213
  * ignore root before all
@@ -202,17 +216,15 @@ class JunitReporter extends reporter_1.default {
202
216
  if (suiteKey.match(/^"before all"/)) {
203
217
  continue;
204
218
  }
205
- // there should only be one spec file per runner so we can safely take the first element of the array
206
- const specFileName = runner.specs[0];
207
219
  const suite = this.suites[suiteKey];
208
- if (isCucumberFrameworkRunner) {
220
+ if (isCucumberFrameworkRunner && suite.type === type) {
209
221
  builder = this._addCucumberFeatureToBuilder(builder, runner, specFileName, suite);
210
222
  }
211
- else {
223
+ else if (!isCucumberFrameworkRunner) {
212
224
  builder = this._addSuiteToBuilder(builder, runner, specFileName, suite);
213
225
  }
214
226
  }
215
- return builder.build();
227
+ return builder;
216
228
  }
217
229
  _getStandardOutput(test) {
218
230
  let standardOutput = [];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wdio/junit-reporter",
3
- "version": "7.1.1",
3
+ "version": "7.1.2",
4
4
  "description": "A WebdriverIO reporter that creates Jenkins compatible XML based JUnit reports",
5
5
  "author": "Christian Bromann <christian@saucelabs.com>",
6
6
  "homepage": "https://github.com/webdriverio/webdriverio/tree/main/packages/wdio-junit-reporter",
@@ -38,5 +38,5 @@
38
38
  "publishConfig": {
39
39
  "access": "public"
40
40
  },
41
- "gitHead": "39b675448969b8548e119a28a1ebc065ec3e6914"
41
+ "gitHead": "3dae2a78bc95f240f7c517b33ab3503b6aa3f3eb"
42
42
  }