@wdio/mocha-framework 9.23.0 → 9.23.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.
@@ -1 +1 @@
1
- {"version":3,"file":"common.d.ts","sourceRoot":"","sources":["../src/common.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,gBAAgB,EAAE,gBAAgB,EAAE,SAAS,EAAE,MAAM,YAAY,CAAA;AA0B/E,wBAAgB,aAAa,CAAE,MAAM,EAAE,gBAAgB,oBA+EtD;AAED;;;;GAIG;AACH,wBAAgB,sBAAsB,CAAE,IAAI,EAAE,MAAM,EAAE,EAAE,MAAM,oBAAa,kBAc1E;AAED,KAAK,IAAI,GAAG,QAAQ,GAAG,QAAQ,EAAE,CAAA;AACjC,wBAAgB,QAAQ,CAAE,GAAG,EAAE,MAAM,EAAE,OAAO,EAAE,SAAS,EAAE,UAAU,EAAE,IAAI,EAAE,UAAU,EAAE,IAAI,EAAE,SAAS,EAAE,IAAI,EAAE,SAAS,EAAE,IAAI,kBAyB9H;AAED,wBAAsB,UAAU,CAAE,IAAI,EAAE,MAAM,gBAQ7C"}
1
+ {"version":3,"file":"common.d.ts","sourceRoot":"","sources":["../src/common.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,gBAAgB,EAAE,gBAAgB,EAAE,SAAS,EAAE,MAAM,YAAY,CAAA;AA0B/E,wBAAgB,aAAa,CAAE,MAAM,EAAE,gBAAgB,oBAiGtD;AAED;;;;GAIG;AACH,wBAAgB,sBAAsB,CAAE,IAAI,EAAE,MAAM,EAAE,EAAE,MAAM,oBAAa,kBAc1E;AAED,KAAK,IAAI,GAAG,QAAQ,GAAG,QAAQ,EAAE,CAAA;AACjC,wBAAgB,QAAQ,CAAE,GAAG,EAAE,MAAM,EAAE,OAAO,EAAE,SAAS,EAAE,UAAU,EAAE,IAAI,EAAE,UAAU,EAAE,IAAI,EAAE,SAAS,EAAE,IAAI,EAAE,SAAS,EAAE,IAAI,kBAyB9H;AAED,wBAAsB,UAAU,CAAE,IAAI,EAAE,MAAM,gBAQ7C"}
package/build/common.js CHANGED
@@ -24,22 +24,28 @@ function formatMessage(params) {
24
24
  const payload = params.payload;
25
25
  const mochaAllHooksIfPresent = payload?.title?.match(/^"(before|after)( all| each)?" hook/);
26
26
  if (params.err) {
27
- if (params.err && params.err.message && params.err.message.includes(MOCHA_TIMEOUT_MESSAGE)) {
28
- const testName = (payload?.parent?.title ? `${payload.parent.title} ${payload.title}` : payload?.title) || "unknown test";
29
- const replacement = `The execution in the test "${testName}" took too long. Try to reduce the run time or increase your timeout for test specs (https://webdriver.io/docs/timeouts).`;
30
- params.err.message = params.err.message.replace(MOCHA_TIMEOUT_MESSAGE, replacement);
31
- params.err.stack = params.err.stack.replace(MOCHA_TIMEOUT_MESSAGE, replacement);
32
- }
33
- message.error = {
34
- name: params.err.name,
35
- message: params.err.message,
36
- stack: params.err.stack,
37
- type: params.err.type || params.err.name,
38
- expected: params.err.expected,
39
- actual: params.err.actual
40
- };
41
- if (mochaAllHooksIfPresent) {
27
+ const isSkipError = /^(sync|async) skip; aborting execution$/.test(params.err.message || "");
28
+ const isHookSkip = isSkipError && mochaAllHooksIfPresent;
29
+ if (isHookSkip) {
42
30
  message.type = "hook:end";
31
+ } else {
32
+ if (params.err && params.err.message && params.err.message.includes(MOCHA_TIMEOUT_MESSAGE)) {
33
+ const testName = (payload?.parent?.title ? `${payload.parent.title} ${payload.title}` : payload?.title) || "unknown test";
34
+ const replacement = `The execution in the test "${testName}" took too long. Try to reduce the run time or increase your timeout for test specs (https://webdriver.io/docs/timeouts).`;
35
+ params.err.message = params.err.message.replace(MOCHA_TIMEOUT_MESSAGE, replacement);
36
+ params.err.stack = params.err.stack.replace(MOCHA_TIMEOUT_MESSAGE, replacement);
37
+ }
38
+ message.error = {
39
+ name: params.err.name,
40
+ message: params.err.message,
41
+ stack: params.err.stack,
42
+ type: params.err.type || params.err.name,
43
+ expected: params.err.expected,
44
+ actual: params.err.actual
45
+ };
46
+ if (mochaAllHooksIfPresent) {
47
+ message.type = "hook:end";
48
+ }
43
49
  }
44
50
  }
45
51
  if (payload) {
package/build/index.js CHANGED
@@ -49,22 +49,28 @@ function formatMessage(params) {
49
49
  const payload = params.payload;
50
50
  const mochaAllHooksIfPresent = payload?.title?.match(/^"(before|after)( all| each)?" hook/);
51
51
  if (params.err) {
52
- if (params.err && params.err.message && params.err.message.includes(MOCHA_TIMEOUT_MESSAGE)) {
53
- const testName = (payload?.parent?.title ? `${payload.parent.title} ${payload.title}` : payload?.title) || "unknown test";
54
- const replacement = `The execution in the test "${testName}" took too long. Try to reduce the run time or increase your timeout for test specs (https://webdriver.io/docs/timeouts).`;
55
- params.err.message = params.err.message.replace(MOCHA_TIMEOUT_MESSAGE, replacement);
56
- params.err.stack = params.err.stack.replace(MOCHA_TIMEOUT_MESSAGE, replacement);
57
- }
58
- message.error = {
59
- name: params.err.name,
60
- message: params.err.message,
61
- stack: params.err.stack,
62
- type: params.err.type || params.err.name,
63
- expected: params.err.expected,
64
- actual: params.err.actual
65
- };
66
- if (mochaAllHooksIfPresent) {
52
+ const isSkipError = /^(sync|async) skip; aborting execution$/.test(params.err.message || "");
53
+ const isHookSkip = isSkipError && mochaAllHooksIfPresent;
54
+ if (isHookSkip) {
67
55
  message.type = "hook:end";
56
+ } else {
57
+ if (params.err && params.err.message && params.err.message.includes(MOCHA_TIMEOUT_MESSAGE)) {
58
+ const testName = (payload?.parent?.title ? `${payload.parent.title} ${payload.title}` : payload?.title) || "unknown test";
59
+ const replacement = `The execution in the test "${testName}" took too long. Try to reduce the run time or increase your timeout for test specs (https://webdriver.io/docs/timeouts).`;
60
+ params.err.message = params.err.message.replace(MOCHA_TIMEOUT_MESSAGE, replacement);
61
+ params.err.stack = params.err.stack.replace(MOCHA_TIMEOUT_MESSAGE, replacement);
62
+ }
63
+ message.error = {
64
+ name: params.err.name,
65
+ message: params.err.message,
66
+ stack: params.err.stack,
67
+ type: params.err.type || params.err.name,
68
+ expected: params.err.expected,
69
+ actual: params.err.actual
70
+ };
71
+ if (mochaAllHooksIfPresent) {
72
+ message.type = "hook:end";
73
+ }
68
74
  }
69
75
  }
70
76
  if (payload) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wdio/mocha-framework",
3
- "version": "9.23.0",
3
+ "version": "9.23.2",
4
4
  "description": "A WebdriverIO plugin. Adapter for Mocha testing framework.",
5
5
  "author": "Christian Bromann <mail@bromann.dev>",
6
6
  "homepage": "https://github.com/webdriverio/webdriverio/tree/main/packages/wdio-mocha-framework",
@@ -39,12 +39,12 @@
39
39
  "@types/mocha": "^10.0.6",
40
40
  "@types/node": "^20.11.28",
41
41
  "@wdio/logger": "9.18.0",
42
- "@wdio/types": "9.20.0",
43
- "@wdio/utils": "9.23.0",
42
+ "@wdio/types": "9.23.2",
43
+ "@wdio/utils": "9.23.2",
44
44
  "mocha": "^10.3.0"
45
45
  },
46
46
  "publishConfig": {
47
47
  "access": "public"
48
48
  },
49
- "gitHead": "5b35e4e2b94e3ac5247ec2bf27f2f5e41ef00372"
49
+ "gitHead": "3447f2744e52b367ad1164ff6a920924d830e4ee"
50
50
  }