@wdio/reporter 8.40.3 → 8.41.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,KAAK,EAAE,WAAW,EAAE,MAAM,SAAS,CAAA;AAC1C,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAA;AAC1C,OAAO,KAAK,EAAE,SAAS,EAAW,MAAM,aAAa,CAAA;AAIrD,OAAO,UAAU,MAAM,kBAAkB,CAAA;AAEzC,OAAO,SAAS,MAAM,iBAAiB,CAAA;AACvC,OAAO,SAAS,EAAE,EAAE,IAAI,EAAE,MAAM,iBAAiB,CAAA;AACjD,OAAO,WAAW,MAAM,mBAAmB,CAAA;AAC3C,OAAO,KAAK,EAAE,gBAAgB,EAAE,iBAAiB,EAAE,WAAW,EAAE,GAAG,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAA;AAEjG,KAAK,iBAAiB,GAAG;IAAE,KAAK,EAAE,CAAC,OAAO,EAAE,GAAG,KAAK,OAAO,CAAA;CAAE,CAAA;AAE7D,MAAM,CAAC,OAAO,OAAO,YAAa,SAAQ,YAAY;IAqB/B,OAAO,EAAE,OAAO,CAAC,SAAS,CAAC,OAAO,CAAC;IApBtD,YAAY,EAAE,WAAW,GAAG,iBAAiB,CAAA;IAC7C,QAAQ,SAAI;IACZ,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,UAAU,CAAC,CAAK;IACvC,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,SAAS,CAAC,CAAK;IACrC,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,SAAS,CAAC,CAAI;IACpC,aAAa,EAAE,UAAU,EAAE,CAAK;IAChC,MAAM;;;;;;;MAOL;IACD,OAAO,SAAI;IACX,UAAU,CAAC,EAAE,WAAW,CAAA;IACxB,gBAAgB,UAAQ;IACxB,K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Aa,EAAE,OAAO;IAGvC,YAAY,CAAC,UAAU,EAAE,UAAU;IAGnC,WAAW,CAAC,QAAQ,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
@@ -1,6 +1,6 @@
1
1
  import fs from 'node:fs';
2
2
  import { EventEmitter } from 'node:events';
3
- import { getErrorsFromEvent } from './utils.js';
3
+ import { getErrorsFromEvent, transformCommandScript } from './utils.js';
4
4
  import SuiteStats from './stats/suite.js';
5
5
  import HookStats from './stats/hook.js';
6
6
  import TestStats from './stats/test.js';
@@ -184,12 +184,24 @@ export default class WDIOReporter extends EventEmitter {
184
184
  if (!currentTest) {
185
185
  return;
186
186
  }
187
+ if (payload.body?.script) {
188
+ payload.body = {
189
+ ...payload.body,
190
+ script: transformCommandScript(payload.body.script)
191
+ };
192
+ }
187
193
  currentTest.output.push(Object.assign(payload, { type: 'command' }));
188
194
  });
189
195
  this.on('client:afterCommand', /* istanbul ignore next */ (payload) => {
190
196
  if (!currentTest) {
191
197
  return;
192
198
  }
199
+ if (payload.body?.script) {
200
+ payload.body = {
201
+ ...payload.body,
202
+ script: transformCommandScript(payload.body.script)
203
+ };
204
+ }
193
205
  currentTest.output.push(Object.assign(payload, { type: 'result' }));
194
206
  });
195
207
  }
package/build/utils.d.ts CHANGED
@@ -42,4 +42,10 @@ export declare function color(type: keyof typeof COLORS, content: string): strin
42
42
  * @return {string}
43
43
  */
44
44
  export declare function colorLines(name: keyof typeof COLORS, str: string): string;
45
+ /**
46
+ * Transforms WebDriver execute command scripts to avoid accumulating
47
+ * long scripts in the default TestStats.
48
+ * @param script WebDriver command script
49
+ */
50
+ export declare function transformCommandScript(script?: string | Function): string | undefined;
45
51
  //# sourceMappingURL=utils.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../src/utils.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,aAAa,CAAA;AAG/C,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,YAAY,CAAC,mBAAmB,UA0BpE;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":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,aAAa,CAAA;AAG/C,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,YAAY,CAAC,mBAAmB,UA0BpE;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/build/utils.js CHANGED
@@ -1,5 +1,6 @@
1
1
  import supportsColor from './supportsColor.js';
2
2
  import { COLORS } from './constants.js';
3
+ const FIRST_FUNCTION_REGEX = /function (\w+)/;
3
4
  /**
4
5
  * replaces whitespaces with underscore and removes dots
5
6
  * @param {string} str variable to sanitize
@@ -91,3 +92,30 @@ export function colorLines(name, str) {
91
92
  .map((str) => color(name, str))
92
93
  .join('\n');
93
94
  }
95
+ /**
96
+ * Transforms WebDriver execute command scripts to avoid accumulating
97
+ * long scripts in the default TestStats.
98
+ * @param script WebDriver command script
99
+ */
100
+ export function transformCommandScript(script) {
101
+ if (!script) {
102
+ return script;
103
+ }
104
+ let name = undefined;
105
+ if (typeof script === 'string') {
106
+ name = FIRST_FUNCTION_REGEX.exec(script);
107
+ // reset the static RegExp globals to avoid leaking `script`
108
+ FIRST_FUNCTION_REGEX.exec('');
109
+ }
110
+ else if (typeof script === 'function') {
111
+ name = script.name;
112
+ script = script.toString();
113
+ }
114
+ else {
115
+ return `<${typeof script}>`;
116
+ }
117
+ if (typeof name === 'string' && name) {
118
+ return `<script fn ${name}(...)> [${Buffer.byteLength(script, 'utf-8')} bytes]`;
119
+ }
120
+ return `<script> [${Buffer.byteLength(script, 'utf-8')} bytes]`;
121
+ }
package/cjs/index.js CHANGED
@@ -194,12 +194,24 @@ class WDIOReporter extends node_events_1.EventEmitter {
194
194
  if (!currentTest) {
195
195
  return;
196
196
  }
197
+ if (payload.body?.script) {
198
+ payload.body = {
199
+ ...payload.body,
200
+ script: (0, utils_js_1.transformCommandScript)(payload.body.script)
201
+ };
202
+ }
197
203
  currentTest.output.push(Object.assign(payload, { type: 'command' }));
198
204
  });
199
205
  this.on('client:afterCommand', /* istanbul ignore next */ (payload) => {
200
206
  if (!currentTest) {
201
207
  return;
202
208
  }
209
+ if (payload.body?.script) {
210
+ payload.body = {
211
+ ...payload.body,
212
+ script: (0, utils_js_1.transformCommandScript)(payload.body.script)
213
+ };
214
+ }
203
215
  currentTest.output.push(Object.assign(payload, { type: 'result' }));
204
216
  });
205
217
  }
package/cjs/utils.js CHANGED
@@ -9,8 +9,10 @@ exports.getErrorsFromEvent = getErrorsFromEvent;
9
9
  exports.pad = pad;
10
10
  exports.color = color;
11
11
  exports.colorLines = colorLines;
12
+ exports.transformCommandScript = transformCommandScript;
12
13
  const supportsColor_js_1 = __importDefault(require("./supportsColor.js"));
13
14
  const constants_js_1 = require("./constants.js");
15
+ const FIRST_FUNCTION_REGEX = /function (\w+)/;
14
16
  /**
15
17
  * replaces whitespaces with underscore and removes dots
16
18
  * @param {string} str variable to sanitize
@@ -102,3 +104,30 @@ function colorLines(name, str) {
102
104
  .map((str) => color(name, str))
103
105
  .join('\n');
104
106
  }
107
+ /**
108
+ * Transforms WebDriver execute command scripts to avoid accumulating
109
+ * long scripts in the default TestStats.
110
+ * @param script WebDriver command script
111
+ */
112
+ function transformCommandScript(script) {
113
+ if (!script) {
114
+ return script;
115
+ }
116
+ let name = undefined;
117
+ if (typeof script === 'string') {
118
+ name = FIRST_FUNCTION_REGEX.exec(script);
119
+ // reset the static RegExp globals to avoid leaking `script`
120
+ FIRST_FUNCTION_REGEX.exec('');
121
+ }
122
+ else if (typeof script === 'function') {
123
+ name = script.name;
124
+ script = script.toString();
125
+ }
126
+ else {
127
+ return `<${typeof script}>`;
128
+ }
129
+ if (typeof name === 'string' && name) {
130
+ return `<script fn ${name}(...)> [${Buffer.byteLength(script, 'utf-8')} bytes]`;
131
+ }
132
+ return `<script> [${Buffer.byteLength(script, 'utf-8')} bytes]`;
133
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wdio/reporter",
3
- "version": "8.40.3",
3
+ "version": "8.41.0",
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",
@@ -43,8 +43,8 @@
43
43
  "dependencies": {
44
44
  "@types/node": "^22.2.0",
45
45
  "@wdio/logger": "8.38.0",
46
- "@wdio/types": "8.40.3",
47
- "diff": "^5.0.0",
46
+ "@wdio/types": "8.41.0",
47
+ "diff": "^7.0.0",
48
48
  "object-inspect": "^1.12.0"
49
49
  },
50
50
  "devDependencies": {
@@ -54,5 +54,5 @@
54
54
  "@types/tmp": "^0.2.3",
55
55
  "tmp": "^0.2.1"
56
56
  },
57
- "gitHead": "c25074cf89bf620cfe18909cd7dbdad8de8e722d"
57
+ "gitHead": "a33b7bfba8013d0f65e54123acc206bd11d38d10"
58
58
  }
@@ -0,0 +1 @@
1
+ {"root":["./src/constants.ts","./src/index.ts","./src/supportsColor.ts","./src/types.ts","./src/utils.ts","./src/stats/hook.ts","./src/stats/runnable.ts","./src/stats/runner.ts","./src/stats/suite.ts","./src/stats/test.ts","../../@types/css-shorthand-properties.d.ts","../../@types/css-value.d.ts","../../@types/custom.d.ts","../../@types/junit-report-builder.d.ts","../../@types/lerna-changelog.d.ts","../../@types/query-selector-shadow-dom.d.ts"],"version":"5.6.2"}
@@ -0,0 +1 @@
1
+ {"root":["./src/constants.ts","./src/index.ts","./src/supportsColor.ts","./src/types.ts","./src/utils.ts","./src/stats/hook.ts","./src/stats/runnable.ts","./src/stats/runner.ts","./src/stats/suite.ts","./src/stats/test.ts","../../@types/css-shorthand-properties.d.ts","../../@types/css-value.d.ts","../../@types/custom.d.ts","../../@types/junit-report-builder.d.ts","../../@types/lerna-changelog.d.ts","../../@types/query-selector-shadow-dom.d.ts"],"version":"5.6.2"}