@wdio/junit-reporter 7.14.1 → 7.15.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.
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,OAAO,YAAY,EAAE,EAAc,WAAW,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAA;AAGjF,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,SAAS,CAAA;AAOnD;;;;;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,SAAS,EAAE,SAAS;IAIjC,WAAW,CAAE,MAAM,EAAE,WAAW;IAKhC,OAAO,CAAC,YAAY;IAMpB,OAAO,CAAC,eAAe;IAkBvB,OAAO,CAAC,4BAA4B;IA+EpC,OAAO,CAAC,kBAAkB;IAqE1B,OAAO,CAAC,cAAc;IAyCtB,OAAO,CAAC,mBAAmB;IAmB3B,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,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAA;AAGjF,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,SAAS,CAAA;AAOnD;;;;;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,SAAS,EAAE,SAAS;IAIjC,WAAW,CAAE,MAAM,EAAE,WAAW;IAKhC,OAAO,CAAC,YAAY;IAMpB,OAAO,CAAC,eAAe;IAkBvB,OAAO,CAAC,4BAA4B;IAgFpC,OAAO,CAAC,kBAAkB;IAsE1B,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
@@ -69,8 +69,9 @@ class JunitReporter extends reporter_1.default {
69
69
  else if (this._activeFeature) {
70
70
  let scenario = suite;
71
71
  const testName = this._prepareName(suite.title);
72
+ const classNameFormat = this.options.classNameFormat ? this.options.classNameFormat({ packageName: this._packageName, activeFeatureName: this._activeFeatureName }) : `${this._packageName}.${this._activeFeatureName}`;
72
73
  const testCase = this._activeFeature.testCase()
73
- .className(`${this._packageName}.${this._activeFeatureName}`)
74
+ .className(classNameFormat)
74
75
  .name(`${testName}`)
75
76
  .time(scenario._duration / 1000);
76
77
  if (this.options.addFileAttribute) {
@@ -139,8 +140,9 @@ class JunitReporter extends reporter_1.default {
139
140
  }
140
141
  const test = suite.tests[testKey];
141
142
  const testName = this._prepareName(test.title);
143
+ const classNameFormat = this.options.classNameFormat ? this.options.classNameFormat({ packageName: this._packageName, suite }) : `${this._packageName}.${suite.fullTitle.replace(/\s/g, '_')}`;
142
144
  const testCase = testSuite.testCase()
143
- .className(`${this._packageName}.${suite.fullTitle.replace(/\s/g, '_')}`)
145
+ .className(classNameFormat)
144
146
  .name(testName)
145
147
  .time(test._duration / 1000);
146
148
  if (this.options.addFileAttribute) {
package/build/types.d.ts CHANGED
@@ -1,4 +1,19 @@
1
1
  import { Reporters } from '@wdio/types';
2
+ import { SuiteStats } from '@wdio/reporter';
3
+ interface ClassNameFormatOptions {
4
+ /**
5
+ * Configured package name
6
+ */
7
+ packageName?: string;
8
+ /**
9
+ * Name of the current cucumber feature
10
+ */
11
+ activeFeatureName?: any;
12
+ /**
13
+ * Context of the current suite
14
+ */
15
+ suite?: SuiteStats;
16
+ }
2
17
  export interface JUnitReporterOptions extends Reporters.Options {
3
18
  /**
4
19
  * Define the xml files created after the test execution.
@@ -23,6 +38,15 @@ export interface JUnitReporterOptions extends Reporters.Options {
23
38
  * @default /[^a-z0-9]+/
24
39
  */
25
40
  suiteNameFormat?: RegExp;
41
+ /**
42
+ * Give the ability to override the generated classname of a test case.
43
+ *
44
+ * @default
45
+ * classNameFormat: function (options) {
46
+ * return ``${options._packageName}.${options.suite.fullTitle.replace(/\s/g, '_')}``
47
+ * }
48
+ */
49
+ classNameFormat?: (options: ClassNameFormatOptions) => string;
26
50
  /**
27
51
  * Adds a file attribute to each testcase. This config is primarily for CircleCI. This setting
28
52
  * provides richer details but may break on other CI platforms.
@@ -90,4 +114,5 @@ export interface JUnitReporterOptions extends Reporters.Options {
90
114
  */
91
115
  errorOptions?: Record<string, string>;
92
116
  }
117
+ export {};
93
118
  //# sourceMappingURL=types.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAA;AAEvC,MAAM,WAAW,oBAAqB,SAAQ,SAAS,CAAC,OAAO;IAC3D;;;;;;;;;;;;;;;OAeG;IACH,gBAAgB,CAAC,EAAE,CAAC,IAAI,EAAE,GAAG,KAAK,MAAM,CAAA;IACxC;;;;OAIG;IACH,eAAe,CAAC,EAAE,MAAM,CAAA;IACxB;;;;;OAKG;IACH,gBAAgB,CAAC,EAAE,OAAO,CAAA;IAC1B;;;;;;;;;;;;;;;;;;;OAmBG;IACH,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OAoCG;IACH,YAAY,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;CACxC"}
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAA;AACvC,OAAO,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAA;AAE3C,UAAU,sBAAsB;IAC5B;;OAEG;IACH,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB;;OAEG;IACH,iBAAiB,CAAC,EAAE,GAAG,CAAA;IACvB;;OAEG;IACH,KAAK,CAAC,EAAE,UAAU,CAAC;CACtB;AAED,MAAM,WAAW,oBAAqB,SAAQ,SAAS,CAAC,OAAO;IAC3D;;;;;;;;;;;;;;;OAeG;IACH,gBAAgB,CAAC,EAAE,CAAC,IAAI,EAAE,GAAG,KAAK,MAAM,CAAA;IACxC;;;;OAIG;IACH,eAAe,CAAC,EAAE,MAAM,CAAA;IACxB;;;;;;;OAOG;IACH,eAAe,CAAC,EAAE,CAAC,OAAO,EAAE,sBAAsB,KAAK,MAAM,CAAA;IAC7D;;;;;OAKG;IACH,gBAAgB,CAAC,EAAE,OAAO,CAAA;IAC1B;;;;;;;;;;;;;;;;;;;OAmBG;IACH,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OAoCG;IACH,YAAY,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;CACxC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wdio/junit-reporter",
3
- "version": "7.14.1",
3
+ "version": "7.15.0",
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": "0f6b6089f675b303741fcb3463779ca248058ae0"
41
+ "gitHead": "dee4470dfbc3bb4516a13c0b26ede2c760d0e3e6"
42
42
  }