@wdio/sync
Advanced tools
Comparing version 5.12.0 to 5.12.1
@@ -36,2 +36,4 @@ "use strict"; | ||
var _utils = require("@wdio/utils"); | ||
var _executeHooksWithArgs = _interopRequireDefault(require("./executeHooksWithArgs")); | ||
@@ -47,3 +49,3 @@ | ||
var _utils = require("./utils"); | ||
var _utils2 = require("./utils"); | ||
@@ -54,20 +56,23 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
const executeSync = function (fn, repeatTest = 0, args = []) { | ||
return new Promise((resolve, reject) => { | ||
try { | ||
const res = fn.apply(this, args); | ||
resolve(res); | ||
} catch (e) { | ||
if (repeatTest) { | ||
return resolve(executeSync(fn, --repeatTest, args)); | ||
} | ||
const executeSync = async function (fn, repeatTest = 0, args = []) { | ||
try { | ||
let res = fn.apply(this, args); | ||
if (!e.stack) { | ||
return reject(e); | ||
} | ||
if (res instanceof Promise) { | ||
return await res; | ||
} | ||
e.stack = e.stack.split('\n').filter(_constants.STACKTRACE_FILTER_FN).join('\n'); | ||
reject(e); | ||
return res; | ||
} catch (e) { | ||
if (repeatTest) { | ||
return await executeSync(fn, --repeatTest, args); | ||
} | ||
}); | ||
if (!e.stack) { | ||
return Promise.reject(e); | ||
} | ||
e.stack = e.stack.split('\n').filter(_constants.STACKTRACE_FILTER_FN).join('\n'); | ||
return Promise.reject(e); | ||
} | ||
}; | ||
@@ -115,7 +120,7 @@ | ||
return (0, _executeHooksWithArgs.default)(before).catch(hookError('beforeHook')).then(() => { | ||
if (hookFn.constructor && hookFn.constructor.name === 'AsyncFunction' || hookFn.name === 'async') { | ||
return executeAsync.call(this, hookFn, repeatTest, (0, _utils.filterSpecArgs)(hookArgs)); | ||
if ((0, _utils.isFunctionAsync)(hookFn)) { | ||
return executeAsync.call(this, hookFn, repeatTest, (0, _utils2.filterSpecArgs)(hookArgs)); | ||
} | ||
return new Promise(runSync.call(this, hookFn, repeatTest, (0, _utils.filterSpecArgs)(hookArgs))); | ||
return new Promise(runSync.call(this, hookFn, repeatTest, (0, _utils2.filterSpecArgs)(hookArgs))); | ||
}).then(() => { | ||
@@ -128,5 +133,5 @@ return (0, _executeHooksWithArgs.default)(after).catch(hookError('afterHook')); | ||
const runSpec = function (specTitle, specFn, origFn, repeatTest = 0) { | ||
if (specFn.constructor && specFn.constructor.name === 'AsyncFunction' || specFn.name === 'async') { | ||
if ((0, _utils.isFunctionAsync)(specFn)) { | ||
return origFn(specTitle, function async(...specArgs) { | ||
return executeAsync.call(this, specFn, repeatTest, (0, _utils.filterSpecArgs)(specArgs)); | ||
return executeAsync.call(this, specFn, repeatTest, (0, _utils2.filterSpecArgs)(specArgs)); | ||
}); | ||
@@ -136,3 +141,3 @@ } | ||
return origFn(specTitle, function (...specArgs) { | ||
return new Promise(runSync.call(this, specFn, repeatTest, (0, _utils.filterSpecArgs)(specArgs))); | ||
return new Promise(runSync.call(this, specFn, repeatTest, (0, _utils2.filterSpecArgs)(specArgs))); | ||
}); | ||
@@ -139,0 +144,0 @@ }; |
{ | ||
"name": "@wdio/sync", | ||
"version": "5.12.0", | ||
"version": "5.12.1", | ||
"description": "A WebdriverIO plugin. Helper module to run WebdriverIO commands synchronously", | ||
@@ -10,3 +10,3 @@ "author": "Christian Bromann <christian@saucelabs.com>", | ||
"engines": { | ||
"node": ">= 10.13.0" | ||
"node": ">= 8.11.0" | ||
}, | ||
@@ -19,3 +19,4 @@ "scripts": { | ||
"test:eslint": "eslint src test", | ||
"test:unit": "jest" | ||
"test:unit": "jest", | ||
"postinstall": "node postinstall.js" | ||
}, | ||
@@ -39,5 +40,5 @@ "types": "./webdriverio.d.ts", | ||
"dependencies": { | ||
"@wdio/config": "^5.12.0", | ||
"@wdio/logger": "^5.12.0", | ||
"fibers": "^4.0.0" | ||
"@wdio/config": "^5.12.1", | ||
"@wdio/logger": "^5.12.1", | ||
"@wdio/utils": "^5.12.1" | ||
}, | ||
@@ -47,3 +48,3 @@ "publishConfig": { | ||
}, | ||
"gitHead": "187c8f044e252877533e53ee2b645f56416d5a41" | ||
"gitHead": "848151e5fdcb8b694c1a273b9b69852c22875687" | ||
} |
Install scripts
Supply chain riskInstall scripts are run when the package is installed. The majority of malware in npm is hidden in install scripts.
Found 1 instance in 1 package
Shell access
Supply chain riskThis module accesses the system shell. Accessing the system shell increases the risk of executing arbitrary code.
Found 1 instance in 1 package
Environment variable access
Supply chain riskPackage accesses environment variables, which may be a sign of credential stuffing or data theft.
Found 1 instance in 1 package
24976
12
702
1
1
1
+ Added@wdio/utils@^5.12.1
+ Added@wdio/utils@5.23.0(transitive)
- Removedfibers@^4.0.0
- Removeddetect-libc@1.0.3(transitive)
- Removedfibers@4.0.3(transitive)
Updated@wdio/config@^5.12.1
Updated@wdio/logger@^5.12.1