@wdio/reporter 8.39.0 → 8.40.6

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
@@ -1,5 +1,3 @@
1
- /// <reference types="node" resolution-mode="require"/>
2
- /// <reference types="node" resolution-mode="require"/>
3
1
  import type { WriteStream } from 'node:fs';
4
2
  import { EventEmitter } from 'node:events';
5
3
  import type { Reporters } from '@wdio/types';
@@ -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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IASlB,aAAa,CAAC,WAAW,EAAE,WAAW;IAGtC,eAAe,CAAC,WAAW,EAAE,iBAAiB;IAG9C,cAAc,CAAC,WAAW,EAAE,gBAAgB;IAG5C,iBAAiB,CAAC,aAAa,EAAE,OAAO;IAGxC,gBAAgB,CAAC,aAAa,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
  }
@@ -8,7 +8,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
8
8
  return (mod && mod.__esModule) ? mod : { "default": mod };
9
9
  };
10
10
  Object.defineProperty(exports, "__esModule", { value: true });
11
- exports.createSupportsColor = void 0;
11
+ exports.createSupportsColor = createSupportsColor;
12
12
  const node_process_1 = __importDefault(require("node:process"));
13
13
  const node_os_1 = __importDefault(require("node:os"));
14
14
  const node_tty_1 = __importDefault(require("node:tty"));
@@ -145,7 +145,6 @@ function createSupportsColor(stream, options = {}) {
145
145
  });
146
146
  return translateLevel(level);
147
147
  }
148
- exports.createSupportsColor = createSupportsColor;
149
148
  const supportsColor = {
150
149
  stdout: createSupportsColor({ isTTY: node_tty_1.default.isatty(1) }),
151
150
  stderr: createSupportsColor({ isTTY: node_tty_1.default.isatty(2) }),
package/cjs/utils.js CHANGED
@@ -3,9 +3,16 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
3
3
  return (mod && mod.__esModule) ? mod : { "default": mod };
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.colorLines = exports.color = exports.pad = exports.getErrorsFromEvent = exports.sanitizeCaps = exports.sanitizeString = void 0;
6
+ exports.sanitizeString = sanitizeString;
7
+ exports.sanitizeCaps = sanitizeCaps;
8
+ exports.getErrorsFromEvent = getErrorsFromEvent;
9
+ exports.pad = pad;
10
+ exports.color = color;
11
+ exports.colorLines = colorLines;
12
+ exports.transformCommandScript = transformCommandScript;
7
13
  const supportsColor_js_1 = __importDefault(require("./supportsColor.js"));
8
14
  const constants_js_1 = require("./constants.js");
15
+ const FIRST_FUNCTION_REGEX = /function (\w+)/;
9
16
  /**
10
17
  * replaces whitespaces with underscore and removes dots
11
18
  * @param {string} str variable to sanitize
@@ -21,7 +28,6 @@ function sanitizeString(str) {
21
28
  .replace(/\s/g, '')
22
29
  .toLowerCase();
23
30
  }
24
- exports.sanitizeString = sanitizeString;
25
31
  /**
26
32
  * formats capability object into sanitized string for e.g.filenames
27
33
  * @param {object} caps Selenium capabilities
@@ -50,7 +56,6 @@ function sanitizeCaps(caps) {
50
56
  result = result.filter(n => n !== undefined && n !== '');
51
57
  return result.join('.');
52
58
  }
53
- exports.sanitizeCaps = sanitizeCaps;
54
59
  /**
55
60
  * Takes a event emitted by a framework and extracts
56
61
  * an array of errors representing test or hook failures.
@@ -68,7 +73,6 @@ function getErrorsFromEvent(e) {
68
73
  }
69
74
  return [];
70
75
  }
71
- exports.getErrorsFromEvent = getErrorsFromEvent;
72
76
  /**
73
77
  * Pads the given `str` to `len`.
74
78
  *
@@ -80,14 +84,12 @@ exports.getErrorsFromEvent = getErrorsFromEvent;
80
84
  function pad(str, len) {
81
85
  return Array(len - str.length + 1).join(' ') + str;
82
86
  }
83
- exports.pad = pad;
84
87
  function color(type, content) {
85
88
  if (!supportsColor_js_1.default.stdout) {
86
89
  return String(content);
87
90
  }
88
91
  return `\u001b[${constants_js_1.COLORS[type]}m${content}\u001b[0m`;
89
92
  }
90
- exports.color = color;
91
93
  /**
92
94
  * Colors lines for `str`, using the color `name`.
93
95
  *
@@ -102,4 +104,30 @@ function colorLines(name, str) {
102
104
  .map((str) => color(name, str))
103
105
  .join('\n');
104
106
  }
105
- exports.colorLines = colorLines;
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.39.0",
3
+ "version": "8.40.6",
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",
@@ -41,10 +41,10 @@
41
41
  },
42
42
  "typeScriptVersion": "3.8.3",
43
43
  "dependencies": {
44
- "@types/node": "^20.1.0",
44
+ "@types/node": "^22.2.0",
45
45
  "@wdio/logger": "8.38.0",
46
- "@wdio/types": "8.39.0",
47
- "diff": "^5.0.0",
46
+ "@wdio/types": "8.40.6",
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": "82da6a28fabaf5f5fad29ea6dc976091027955f8"
57
+ "gitHead": "b08ce8de4710ec3285efde033a94e257b774508b"
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"}