@wdio/sync
Advanced tools
Comparing version 5.11.7 to 5.11.9
@@ -26,8 +26,12 @@ "use strict"; | ||
return function wrapCommandFn(...args) { | ||
// save error for getting full stack in case of failure | ||
// should be before any async calls | ||
const stackError = new Error(); | ||
/** | ||
* Avoid running some functions in Future that are not in Fiber. | ||
*/ | ||
if (this._NOT_FIBER === true) { | ||
this._NOT_FIBER = isNotInFiber(this, fn.name); | ||
return runCommand.apply(this, [fn, ...args]); | ||
return runCommand.apply(this, [fn, stackError, ...args]); | ||
} | ||
@@ -41,3 +45,3 @@ /** | ||
const future = new _future.default(); | ||
const result = runCommandWithHooks.apply(this, [commandName, fn, ...args]); | ||
const result = runCommandWithHooks.apply(this, [commandName, fn, stackError, ...args]); | ||
result.then(future.return.bind(future), future.throw.bind(future)); | ||
@@ -66,2 +70,3 @@ | ||
this._NOT_FIBER = false; | ||
throw e; | ||
@@ -76,3 +81,3 @@ } | ||
async function runCommandWithHooks(commandName, fn, ...args) { | ||
async function runCommandWithHooks(commandName, fn, stackError, ...args) { | ||
await (0, _executeHooksWithArgs.default)(this.options.beforeCommand, [commandName, args]); | ||
@@ -83,3 +88,3 @@ let commandResult; | ||
try { | ||
commandResult = await runCommand.apply(this, [fn, ...args]); | ||
commandResult = await runCommand.apply(this, [fn, stackError, ...args]); | ||
} catch (err) { | ||
@@ -98,7 +103,3 @@ commandError = err; | ||
async function runCommand(fn, ...args) { | ||
// save error for getting full stack in case of failure | ||
// should be before any async calls | ||
const stackError = new Error(); | ||
async function runCommand(fn, stackError, ...args) { | ||
try { | ||
@@ -105,0 +106,0 @@ return await fn.apply(this, args); |
{ | ||
"name": "@wdio/sync", | ||
"version": "5.11.7", | ||
"version": "5.11.9", | ||
"description": "A WebdriverIO plugin. Helper module to run WebdriverIO commands synchronously", | ||
@@ -44,3 +44,3 @@ "author": "Christian Bromann <christian@saucelabs.com>", | ||
}, | ||
"gitHead": "945feb83efec8431cb448293bb2cc0f3b7fc1c16" | ||
"gitHead": "a2d869d56d4f9a2fd4dd99d653c5cba6a6f943dc" | ||
} |
@@ -148,3 +148,3 @@ /// <reference types="node"/> | ||
afterFeature?(uri: any, feature: any, scenario: any, step: any, result: any): void; | ||
afterScenario?(uri: any, feature: any, scenario: any): void; | ||
afterScenario?(uri: any, feature: any, scenario: any, result: {status: string, duration: number}): void; | ||
afterStep?(uri: any, feature: any): void; | ||
@@ -151,0 +151,0 @@ } |
30767
848