@wdio/utils 8.0.0-alpha.558 → 8.0.0-alpha.565

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
@@ -3,14 +3,14 @@ import { initialiseWorkerService, initialiseLauncherService } from './initialise
3
3
  import webdriverMonad from './monad.js';
4
4
  import { commandCallStructure, isValidParameter, getArgumentType, safeImport, isFunctionAsync, transformCommandLogResult, canAccess, sleep } from './utils.js';
5
5
  import { wrapCommand, executeHooksWithArgs, executeAsync } from './shim.js';
6
- import { testFnWrapper, runTestInFiberContext } from './test-framework/index.js';
6
+ import { testFnWrapper, wrapGlobalTestMethod } from './test-framework/index.js';
7
7
  import { isW3C, capabilitiesEnvironmentDetector, sessionEnvironmentDetector, devtoolsEnvironmentDetector } from './envDetector.js';
8
8
  import { UNICODE_CHARACTERS } from './constants.js';
9
9
  export { initialisePlugin, initialiseLauncherService, initialiseWorkerService, isFunctionAsync, transformCommandLogResult, webdriverMonad, commandCallStructure, isValidParameter, getArgumentType, safeImport, canAccess, sleep,
10
10
  /**
11
11
  * runner shim
12
12
  */
13
- wrapCommand, executeAsync, runTestInFiberContext, testFnWrapper, executeHooksWithArgs,
13
+ wrapCommand, executeAsync, wrapGlobalTestMethod, testFnWrapper, executeHooksWithArgs,
14
14
  /**
15
15
  * environmentDetector
16
16
  */
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAEA,OAAO,gBAAgB,MAAM,uBAAuB,CAAA;AACpD,OAAO,EAAE,uBAAuB,EAAE,yBAAyB,EAAE,MAAM,yBAAyB,CAAA;AAC5F,OAAO,cAAc,MAAM,YAAY,CAAA;AACvC,OAAO,EACH,oBAAoB,EAAE,gBAAgB,EAAE,eAAe,EAAE,UAAU,EACnE,eAAe,EAAE,yBAAyB,EAAE,SAAS,EAAE,KAAK,EAC/D,MAAM,YAAY,CAAA;AACnB,OAAO,E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AAkB,EAAE,MAAM,gBAAgB,CAAA;AAEnD,OAAO,EACH,gBAAgB,EAChB,yBAAyB,EACzB,uBAAuB,EACvB,eAAe,EACf,yBAAyB,EACzB,cAAc,EACd,oBAAoB,EACpB,gBAAgB,EAChB,eAAe,EACf,UAAU,EACV,SAAS,EACT,KAAK;AAEL;;GAEG;AACH,WAAW,EACX,YAAY,EACZ,oBAAoB,EACpB,aAAa,EACb,oBAAoB;AAEpB;;GAEG;AACH,KAAK,EACL,0BAA0B,EAC1B,+BAA+B,EAC/B,2BAA2B;AAE3B;;GAEG;AACH,kBAAkB,EACrB,CAAA"}
package/build/index.js CHANGED
@@ -4,14 +4,14 @@ import { initialiseWorkerService, initialiseLauncherService } from './initialise
4
4
  import webdriverMonad from './monad.js';
5
5
  import { commandCallStructure, isValidParameter, getArgumentType, safeImport, isFunctionAsync, transformCommandLogResult, canAccess, sleep } from './utils.js';
6
6
  import { wrapCommand, executeHooksWithArgs, executeAsync } from './shim.js';
7
- import { testFnWrapper, runTestInFiberContext } from './test-framework/index.js';
7
+ import { testFnWrapper, wrapGlobalTestMethod } from './test-framework/index.js';
8
8
  import { isW3C, capabilitiesEnvironmentDetector, sessionEnvironmentDetector, devtoolsEnvironmentDetector } from './envDetector.js';
9
9
  import { UNICODE_CHARACTERS } from './constants.js';
10
10
  export { initialisePlugin, initialiseLauncherService, initialiseWorkerService, isFunctionAsync, transformCommandLogResult, webdriverMonad, commandCallStructure, isValidParameter, getArgumentType, safeImport, canAccess, sleep,
11
11
  /**
12
12
  * runner shim
13
13
  */
14
- wrapCommand, executeAsync, runTestInFiberContext, testFnWrapper, executeHooksWithArgs,
14
+ wrapCommand, executeAsync, wrapGlobalTestMethod, testFnWrapper, executeHooksWithArgs,
15
15
  /**
16
16
  * environmentDetector
17
17
  */
package/build/shim.js CHANGED
@@ -40,7 +40,7 @@ let executeHooksWithArgs = async function executeHooksWithArgsShim(hookName, hoo
40
40
  */
41
41
  if (result && typeof result.then === 'function') {
42
42
  return result.then(resolve, (e) => {
43
- log.error(e.stack);
43
+ log.error(e.stack || e.message);
44
44
  resolve(e);
45
45
  });
46
46
  }
@@ -1 +1 @@
1
- {"version":3,"file":"errorHandler.d.ts","sourceRoot":"","sources":["../../src/test-framework/errorHandler.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AACH,eAAO,MAAM,YAAY,aAAc,MAAM,uCAAgC,MAAM,SAwBlF,CAAA"}
1
+ {"version":3,"file":"errorHandler.d.ts","sourceRoot":"","sources":["../../src/test-framework/errorHandler.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AACH,eAAO,MAAM,YAAY,aAAc,MAAM,uCAAgC,MAAM,SA0BlF,CAAA"}
@@ -23,9 +23,11 @@ export const logHookError = (hookName, hookResults = [], cid) => {
23
23
  type: 'hook',
24
24
  state: 'fail'
25
25
  };
26
- process.send({
27
- origin: 'reporter',
28
- name: 'printFailureMessage',
29
- content
30
- });
26
+ if (globalThis.process) {
27
+ process.send({
28
+ origin: 'reporter',
29
+ name: 'printFailureMessage',
30
+ content
31
+ });
32
+ }
31
33
  };
@@ -1,4 +1,4 @@
1
1
  import { testFnWrapper } from './testFnWrapper.js';
2
- import { runTestInFiberContext } from './testInterfaceWrapper.js';
3
- export { testFnWrapper, runTestInFiberContext };
2
+ import { wrapGlobalTestMethod } from './testInterfaceWrapper.js';
3
+ export { testFnWrapper, wrapGlobalTestMethod };
4
4
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/test-framework/index.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAA;AAClD,OAAO,EAAE,qBAAqB,EAAE,MAAM,2BAA2B,CAAA;AAEjE,OAAO,EAAE,aAAa,EAAE,qBAAqB,EAAE,CAAA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/test-framework/index.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAA;AAClD,OAAO,EAAE,oBAAoB,EAAE,MAAM,2BAA2B,CAAA;AAEhE,OAAO,EAAE,aAAa,EAAE,oBAAoB,EAAE,CAAA"}
@@ -1,4 +1,4 @@
1
1
  /* istanbul ignore file */
2
2
  import { testFnWrapper } from './testFnWrapper.js';
3
- import { runTestInFiberContext } from './testInterfaceWrapper.js';
4
- export { testFnWrapper, runTestInFiberContext };
3
+ import { wrapGlobalTestMethod } from './testInterfaceWrapper.js';
4
+ export { testFnWrapper, wrapGlobalTestMethod };
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  * used to wrap mocha, jasmine test frameworks functions (`it`, `beforeEach` and other)
3
3
  * with WebdriverIO before/after Test/Hook hooks.
4
- * Entrypoint is `runTestInFiberContext`, other functions are exported for testing purposes.
4
+ * Entrypoint is `wrapGlobalTestMethod`, other functions are exported for testing purposes.
5
5
  *
6
6
  * NOTE: not used by cucumber test framework. `testFnWrapper` is called directly there
7
7
  */
@@ -63,5 +63,5 @@ export declare const wrapTestFunction: (this: unknown, origFn: Function, isSpec:
63
63
  * @param {String} cid cid
64
64
  * @param {Object} scope the scope to run command from, defaults to global
65
65
  */
66
- export declare const runTestInFiberContext: (this: unknown, isSpec: boolean, beforeFn: Function | Function[], beforeArgsFn: HookFnArgs<unknown>, afterFn: Function | Function[], afterArgsFn: HookFnArgs<unknown>, fnName: string, cid: string, scope?: typeof globalThis) => void;
66
+ export declare const wrapGlobalTestMethod: (this: unknown, isSpec: boolean, beforeFn: Function | Function[], beforeArgsFn: HookFnArgs<unknown>, afterFn: Function | Function[], afterArgsFn: HookFnArgs<unknown>, fnName: string, cid: string, scope?: typeof globalThis) => void;
67
67
  //# sourceMappingURL=testInterfaceWrapper.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"testInterfaceWrapper.d.ts","sourceRoot":"","sources":["../../src/test-framework/testInterfaceWrapper.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAKH,OAAO,KAAK,EACR,UAAU,EAIV,aAAa,EAChB,MAAM,SAAS,CAAA;AAIhB;;;;;;;;;;;;GAYG;AACH,eAAO,MAAM,OAAO,SACV,OAAO,UACL,QAAQ,UACR,QAAQ,YACN,QAAQ,GAAG,QAAQ,EAAE,gBACjB,WAAW,OAAO,CAAC,WACxB,QAAQ,GAAG,QAAQ,EAAE,eACjB,WAAW,OAAO,CAAC,OAC3B,MAAM,cACC,MAAM,WACT,MAAM,QAgClB,CAAA;AAED;;;;;;;;;;;;;GAaG;AACH,eAAO,MAAM,OAAO,SACV,OAAO,aACF,MAAM,UACT,QAAQ,UACR,QAAQ,YACN,QAAQ,GAAG,QAAQ,EAAE,gBACjB,WAAW,OAAO,CAAC,WACxB,QAAQ,GAAG,QAAQ,EAAE,eACjB,WAAW,OAAO,CAAC,OAC3B,MAAM,cACC,MAAM,WACT,MAAM,QAgClB,CAAA;AAED;;;;;;;;;;;;GAYG;AACH,eAAO,MAAM,gBAAgB,SACnB,OAAO,UACL,QAAQ,UACR,OAAO,YACL,QAAQ,GAAG,QAAQ,EAAE,gBACjB,WAAW,OAAO,CAAC,WACxB,QAAQ,GAAG,QAAQ,EAAE,eACjB,WAAW,OAAO,CAAC,OAC3B,MAAM,wBAEwB,aAAa,QAkEnD,CAAA;AAED;;;;;;;;;;;;;GAaG;AACH,eAAO,MAAM,qBAAqB,SACxB,OAAO,UACL,OAAO,YACL,QAAQ,GAAG,QAAQ,EAAE,gBACjB,WAAW,OAAO,CAAC,WACxB,QAAQ,GAAG,QAAQ,EAAE,eACjB,WAAW,OAAO,CAAC,UACxB,MAAM,OACT,MAAM,oCAcd,CAAA"}
1
+ {"version":3,"file":"testInterfaceWrapper.d.ts","sourceRoot":"","sources":["../../src/test-framework/testInterfaceWrapper.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAKH,OAAO,KAAK,EACR,UAAU,EAIV,aAAa,EAChB,MAAM,SAAS,CAAA;AAIhB;;;;;;;;;;;;GAYG;AACH,eAAO,MAAM,OAAO,SACV,OAAO,UACL,QAAQ,UACR,QAAQ,YACN,QAAQ,GAAG,QAAQ,EAAE,gBACjB,WAAW,OAAO,CAAC,WACxB,QAAQ,GAAG,QAAQ,EAAE,eACjB,WAAW,OAAO,CAAC,OAC3B,MAAM,cACC,MAAM,WACT,MAAM,QAgClB,CAAA;AAED;;;;;;;;;;;;;GAaG;AACH,eAAO,MAAM,OAAO,SACV,OAAO,aACF,MAAM,UACT,QAAQ,UACR,QAAQ,YACN,QAAQ,GAAG,QAAQ,EAAE,gBACjB,WAAW,OAAO,CAAC,WACxB,QAAQ,GAAG,QAAQ,EAAE,eACjB,WAAW,OAAO,CAAC,OAC3B,MAAM,cACC,MAAM,WACT,MAAM,QAgClB,CAAA;AAED;;;;;;;;;;;;GAYG;AACH,eAAO,MAAM,gBAAgB,SACnB,OAAO,UACL,QAAQ,UACR,OAAO,YACL,QAAQ,GAAG,QAAQ,EAAE,gBACjB,WAAW,OAAO,CAAC,WACxB,QAAQ,GAAG,QAAQ,EAAE,eACjB,WAAW,OAAO,CAAC,OAC3B,MAAM,wBAEwB,aAAa,QAkEnD,CAAA;AAED;;;;;;;;;;;;;GAaG;AACH,eAAO,MAAM,oBAAoB,SACvB,OAAO,UACL,OAAO,YACL,QAAQ,GAAG,QAAQ,EAAE,gBACjB,WAAW,OAAO,CAAC,WACxB,QAAQ,GAAG,QAAQ,EAAE,eACjB,WAAW,OAAO,CAAC,UACxB,MAAM,OACT,MAAM,oCAcd,CAAA"}
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  * used to wrap mocha, jasmine test frameworks functions (`it`, `beforeEach` and other)
3
3
  * with WebdriverIO before/after Test/Hook hooks.
4
- * Entrypoint is `runTestInFiberContext`, other functions are exported for testing purposes.
4
+ * Entrypoint is `wrapGlobalTestMethod`, other functions are exported for testing purposes.
5
5
  *
6
6
  * NOTE: not used by cucumber test framework. `testFnWrapper` is called directly there
7
7
  */
@@ -91,9 +91,9 @@ export const wrapTestFunction = function (origFn, isSpec, beforeFn, beforeArgsFn
91
91
  * should be [title, fn, timeout, retryCnt]
92
92
  */
93
93
  // @ts-expect-error
94
- let timeout = global.jasmine?.DEFAULT_TIMEOUT_INTERVAL;
94
+ let timeout = globalThis.jasmine?.DEFAULT_TIMEOUT_INTERVAL;
95
95
  // @ts-expect-error
96
- if (global.jasmine) {
96
+ if (globalThis.jasmine) {
97
97
  // if we have [title, fn, timeout, retryCnt]
98
98
  if (typeof specArguments[specArguments.length - 1] === 'number') {
99
99
  timeout = specArguments.pop();
@@ -133,7 +133,7 @@ export const wrapTestFunction = function (origFn, isSpec, beforeFn, beforeArgsFn
133
133
  * @param {String} cid cid
134
134
  * @param {Object} scope the scope to run command from, defaults to global
135
135
  */
136
- export const runTestInFiberContext = function (isSpec, beforeFn, beforeArgsFn, afterFn, afterArgsFn, fnName, cid, scope = global) {
136
+ export const wrapGlobalTestMethod = function (isSpec, beforeFn, beforeArgsFn, afterFn, afterArgsFn, fnName, cid, scope = globalThis) {
137
137
  const origFn = scope[fnName];
138
138
  scope[fnName] = wrapTestFunction(origFn, isSpec, beforeFn, beforeArgsFn, afterFn, afterArgsFn, cid);
139
139
  addMochaCommands(origFn, scope[fnName]);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wdio/utils",
3
- "version": "8.0.0-alpha.558+9156ec0f4",
3
+ "version": "8.0.0-alpha.565+9959d0e91",
4
4
  "description": "A WDIO helper utility to provide several utility functions used across the project.",
5
5
  "author": "Christian Bromann <mail@bromann.dev>",
6
6
  "homepage": "https://github.com/webdriverio/webdriverio/tree/main/packages/wdio-utils",
@@ -27,12 +27,12 @@
27
27
  "url": "https://github.com/webdriverio/webdriverio/issues"
28
28
  },
29
29
  "dependencies": {
30
- "@wdio/logger": "8.0.0-alpha.558+9156ec0f4",
31
- "@wdio/types": "8.0.0-alpha.558+9156ec0f4",
30
+ "@wdio/logger": "8.0.0-alpha.565+9959d0e91",
31
+ "@wdio/types": "8.0.0-alpha.565+9959d0e91",
32
32
  "p-iteration": "^1.1.8"
33
33
  },
34
34
  "publishConfig": {
35
35
  "access": "public"
36
36
  },
37
- "gitHead": "9156ec0f422b7e784ea148e569fe423ba21a0355"
37
+ "gitHead": "9959d0e91c0f7d2991a5a0c1eb34d288894dae74"
38
38
  }