@wdio/reporter 9.0.0 → 9.0.4

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.cjs CHANGED
@@ -193,6 +193,7 @@ var COLORS = {
193
193
  };
194
194
 
195
195
  // src/utils.ts
196
+ var FIRST_FUNCTION_REGEX = /function (\w+)/;
196
197
  function sanitizeString(str) {
197
198
  if (!str) {
198
199
  return "";
@@ -242,6 +243,25 @@ function color(type, content) {
242
243
  function colorLines(name, str) {
243
244
  return str.split("\n").map((str2) => color(name, str2)).join("\n");
244
245
  }
246
+ function transformCommandScript(script) {
247
+ if (!script) {
248
+ return script;
249
+ }
250
+ let name = void 0;
251
+ if (typeof script === "string") {
252
+ name = FIRST_FUNCTION_REGEX.exec(script);
253
+ FIRST_FUNCTION_REGEX.exec("");
254
+ } else if (typeof script === "function") {
255
+ name = script.name;
256
+ script = script.toString();
257
+ } else {
258
+ return `<${typeof script}>`;
259
+ }
260
+ if (typeof name === "string" && name) {
261
+ return `<script fn ${name}(...)> [${Buffer.byteLength(script, "utf-8")} bytes]`;
262
+ }
263
+ return `<script> [${Buffer.byteLength(script, "utf-8")} bytes]`;
264
+ }
245
265
 
246
266
  // src/stats/runnable.ts
247
267
  var RunnableStats = class {
@@ -629,6 +649,12 @@ var WDIOReporter = class extends import_node_events.EventEmitter {
629
649
  if (!currentTest) {
630
650
  return;
631
651
  }
652
+ if (payload.body?.script) {
653
+ payload.body = {
654
+ ...payload.body,
655
+ script: transformCommandScript(payload.body.script)
656
+ };
657
+ }
632
658
  currentTest.output.push(Object.assign(payload, { type: "command" }));
633
659
  }
634
660
  );
@@ -639,6 +665,12 @@ var WDIOReporter = class extends import_node_events.EventEmitter {
639
665
  if (!currentTest) {
640
666
  return;
641
667
  }
668
+ if (payload.body?.script) {
669
+ payload.body = {
670
+ ...payload.body,
671
+ script: transformCommandScript(payload.body.script)
672
+ };
673
+ }
642
674
  currentTest.output.push(Object.assign(payload, { type: "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Q,EAAE,SAAS;IAG/B,SAAS,CAAC,SAAS,EAAE,SAAS;IAG9B,WAAW,CAAC,SAAS,EAAE,SAAS;IAGhC,UAAU,CAAC,SAAS,EAAE,SAAS;IAG/B,UAAU,CAAC,SAAS,EAAE,SAAS;IAG/B,WAAW,CAAC,SAAS,EAAE,SAAS;IAGhC,UAAU,CAAC,SAAS,EAAE,SAAS;IAG/B,SAAS,CAAC,SAAS,EAAE,SAAS;IAG9B,UAAU,CAAC,UAAU,EAAE,UAAU;IAGjC,WAAW,CAAC,WAAW,EAAE,WAAW;CACvC;AAED,OAAO,EACH,UAAU,EAAE,GAAG,EAAE,SAAS,EAAE,SAAS,EAAE,WAAW,EAAE,iBAAiB,EACrE,gBAAgB,EAAE,WAAW,EAAE,QAAQ,EAAE,IAAI,EAChD,CAAA"}
package/build/index.js CHANGED
@@ -154,6 +154,7 @@ var COLORS = {
154
154
  };
155
155
 
156
156
  // src/utils.ts
157
+ var FIRST_FUNCTION_REGEX = /function (\w+)/;
157
158
  function sanitizeString(str) {
158
159
  if (!str) {
159
160
  return "";
@@ -203,6 +204,25 @@ function color(type, content) {
203
204
  function colorLines(name, str) {
204
205
  return str.split("\n").map((str2) => color(name, str2)).join("\n");
205
206
  }
207
+ function transformCommandScript(script) {
208
+ if (!script) {
209
+ return script;
210
+ }
211
+ let name = void 0;
212
+ if (typeof script === "string") {
213
+ name = FIRST_FUNCTION_REGEX.exec(script);
214
+ FIRST_FUNCTION_REGEX.exec("");
215
+ } else if (typeof script === "function") {
216
+ name = script.name;
217
+ script = script.toString();
218
+ } else {
219
+ return `<${typeof script}>`;
220
+ }
221
+ if (typeof name === "string" && name) {
222
+ return `<script fn ${name}(...)> [${Buffer.byteLength(script, "utf-8")} bytes]`;
223
+ }
224
+ return `<script> [${Buffer.byteLength(script, "utf-8")} bytes]`;
225
+ }
206
226
 
207
227
  // src/stats/runnable.ts
208
228
  var RunnableStats = class {
@@ -590,6 +610,12 @@ var WDIOReporter = class extends EventEmitter {
590
610
  if (!currentTest) {
591
611
  return;
592
612
  }
613
+ if (payload.body?.script) {
614
+ payload.body = {
615
+ ...payload.body,
616
+ script: transformCommandScript(payload.body.script)
617
+ };
618
+ }
593
619
  currentTest.output.push(Object.assign(payload, { type: "command" }));
594
620
  }
595
621
  );
@@ -600,6 +626,12 @@ var WDIOReporter = class extends EventEmitter {
600
626
  if (!currentTest) {
601
627
  return;
602
628
  }
629
+ if (payload.body?.script) {
630
+ payload.body = {
631
+ ...payload.body,
632
+ script: transformCommandScript(payload.body.script)
633
+ };
634
+ }
603
635
  currentTest.output.push(Object.assign(payload, { type: "result" }));
604
636
  }
605
637
  );
package/build/utils.d.ts CHANGED
@@ -41,4 +41,10 @@ export declare function color(type: keyof typeof COLORS, content: string): strin
41
41
  * @return {string}
42
42
  */
43
43
  export declare function colorLines(name: keyof typeof COLORS, str: string): string;
44
+ /**
45
+ * Transforms WebDriver execute command scripts to avoid accumulating
46
+ * long scripts in the default TestStats.
47
+ * @param script WebDriver command script
48
+ */
49
+ export declare function transformCommandScript(script?: string | Function): string | undefined;
44
50
  //# sourceMappingURL=utils.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../src/utils.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,MAAM,EAAE,MAAM,gBAAgB,CAAA;AAEvC;;;;GAIG;AACH,wBAAgB,cAAc,CAAE,GAAG,CAAC,EAAE,MAAM,UAU3C;AAED;;;GAGG;AACH,wBAAgB,YAAY,CAAE,IAAI,CAAC,EAAE,WAAW,CAAC,YAAY,UA8B5D;AAED;;;;;;;GAOG;AACH,wBAAgB,kBAAkB,CAAC,CAAC,EAAE;IAAE,MAAM,CAAC,EAAE,GAAG,CAAC;IAAC,KAAK,CAAC,EAAE,GAAG,CAAA;CAAE,OAQlE;AAED;;;;;;;GAOG;AACH,wBAAgB,GAAG,CAAE,GAAG,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,UAE5C;AAED,wBAAgB,KAAK,CAAE,IAAI,EAAE,MAAM,OAAO,MAAM,EAAE,OAAO,EAAE,MAAM,UAKhE;AAED;;;;;;;GAOG;AACH,wBAAgB,UAAU,CAAE,IAAI,EAAE,MAAM,OAAO,MAAM,EAAE,GAAG,EAAE,MAAM,UAKjE"}
1
+ {"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../src/utils.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,MAAM,EAAE,MAAM,gBAAgB,CAAA;AAIvC;;;;GAIG;AACH,wBAAgB,cAAc,CAAE,GAAG,CAAC,EAAE,MAAM,UAU3C;AAED;;;GAGG;AACH,wBAAgB,YAAY,CAAE,IAAI,CAAC,EAAE,WAAW,CAAC,YAAY,UA8B5D;AAED;;;;;;;GAOG;AACH,wBAAgB,kBAAkB,CAAC,CAAC,EAAE;IAAE,MAAM,CAAC,EAAE,GAAG,CAAC;IAAC,KAAK,CAAC,EAAE,GAAG,CAAA;CAAE,OAQlE;AAED;;;;;;;GAOG;AACH,wBAAgB,GAAG,CAAE,GAAG,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,UAE5C;AAED,wBAAgB,KAAK,CAAE,IAAI,EAAE,MAAM,OAAO,MAAM,EAAE,OAAO,EAAE,MAAM,UAKhE;AAED;;;;;;;GAOG;AACH,wBAAgB,UAAU,CAAE,IAAI,EAAE,MAAM,OAAO,MAAM,EAAE,GAAG,EAAE,MAAM,UAKjE;AAED;;;;GAIG;AACH,wBAAgB,sBAAsB,CAAE,MAAM,CAAC,EAAE,MAAM,GAAC,QAAQ,sBAoB/D"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wdio/reporter",
3
- "version": "9.0.0",
3
+ "version": "9.0.4",
4
4
  "description": "A WebdriverIO utility to help reporting all events",
5
5
  "author": "Christian Bromann <mail@bromann.dev>",
6
6
  "homepage": "https://github.com/webdriverio/webdriverio/tree/main/packages/wdio-reporter",
@@ -10,7 +10,7 @@
10
10
  },
11
11
  "repository": {
12
12
  "type": "git",
13
- "url": "git://github.com/webdriverio/webdriverio.git",
13
+ "url": "git+https://github.com/webdriverio/webdriverio.git",
14
14
  "directory": "packages/wdio-reporter"
15
15
  },
16
16
  "keywords": [
@@ -38,8 +38,8 @@
38
38
  "typeScriptVersion": "3.8.3",
39
39
  "dependencies": {
40
40
  "@types/node": "^20.1.0",
41
- "@wdio/logger": "9.0.0",
42
- "@wdio/types": "9.0.0",
41
+ "@wdio/logger": "9.0.4",
42
+ "@wdio/types": "9.0.4",
43
43
  "diff": "^5.0.0",
44
44
  "object-inspect": "^1.12.0"
45
45
  },
@@ -50,5 +50,5 @@
50
50
  "@types/tmp": "^0.2.3",
51
51
  "tmp": "^0.2.1"
52
52
  },
53
- "gitHead": "957693463371a4cb329395dcdbce8fb0c930ab93"
53
+ "gitHead": "1f3d6f781391548e8672e768e72b3d5c499a3aa7"
54
54
  }