New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@wdio/sync

Package Overview
Dependencies
Maintainers
4
Versions
259
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@wdio/sync - npm Package Compare versions

Comparing version 5.14.4 to 5.15.1

30

build/index.js

@@ -68,31 +68,13 @@ "use strict";

const executeAsync = function (fn, repeatTest = 0, args = []) {
let result, error;
const executeAsync = async function (fn, repeatTest = 0, args = []) {
try {
result = fn.apply(this, args);
return await fn.apply(this, args);
} catch (e) {
error = e;
}
if (error) {
if (repeatTest) {
return executeAsync(fn, --repeatTest, args);
if (repeatTest > 0) {
return await executeAsync(fn, --repeatTest, args);
}
return new Promise((resolve, reject) => reject(error));
e.stack = e.stack.split('\n').filter(_constants.STACKTRACE_FILTER_FN).join('\n');
throw e;
}
if (repeatTest === 0 || !result || typeof result.catch !== 'function') {
return new Promise(resolve => resolve(result));
}
return result.catch(e => {
if (repeatTest) {
return executeAsync(fn, --repeatTest, args);
}
e.stack = e.stack.split('\n').filter(_constants.STACKTRACE_FILTER_FN).join('\n');
return Promise.reject(e);
});
};

@@ -99,0 +81,0 @@

38

build/wrapCommand.js

@@ -19,3 +19,25 @@ "use strict";

const log = (0, _logger.default)('@wdio/sync');
let inCommandHook = false;
const timers = [];
const elements = new Set();
process.on('WDIO_TIMER', payload => {
if (payload.start) {
return timers.push(payload.id);
}
if (timers.includes(payload.id)) {
while (timers.pop() !== payload.id);
}
if (payload.timeout) {
elements.forEach(element => {
delete element._NOT_FIBER;
});
}
if (timers.length === 0) {
elements.clear();
}
});
function wrapCommand(commandName, fn) {

@@ -27,2 +49,6 @@ return function wrapCommandFn(...args) {

if (timers.length > 0) {
elements.add(this);
}
if (this._NOT_FIBER === true) {

@@ -59,3 +85,3 @@ this._NOT_FIBER = isNotInFiber(this, fn.name);

const stackError = new Error();
await (0, _executeHooksWithArgs.default)(this.options.beforeCommand, [commandName, args]);
await runCommandHook.call(this, this.options.beforeCommand, [commandName, args]);
let commandResult;

@@ -70,3 +96,3 @@ let commandError;

await (0, _executeHooksWithArgs.default)(this.options.afterCommand, [commandName, args, commandResult, commandError]);
await runCommandHook.call(this, this.options.afterCommand, [commandName, args, commandResult, commandError]);

@@ -80,2 +106,10 @@ if (commandError) {

async function runCommandHook(hookFn, args) {
if (!inCommandHook) {
inCommandHook = true;
await (0, _executeHooksWithArgs.default)(hookFn, args);
inCommandHook = false;
}
}
function isNotInFiber(context, fnName) {

@@ -82,0 +116,0 @@ return fnName !== '' && !!(context.elementId || context.parent && context.parent.elementId);

{
"name": "@wdio/sync",
"version": "5.14.4",
"version": "5.15.1",
"description": "A WebdriverIO plugin. Helper module to run WebdriverIO commands synchronously",

@@ -46,3 +46,3 @@ "author": "Christian Bromann <christian@saucelabs.com>",

},
"gitHead": "a61e97749a57e7b9e86864cbdf03456c71fd876a"
"gitHead": "03d712f71c7df07873b72dd3d7d19f08d8c00dc9"
}

@@ -178,3 +178,5 @@ /// <reference types="node"/>

clearValue(): void;
click(): void;
click(
options?: object
): void;
doubleClick(): void;

@@ -181,0 +183,0 @@ dragAndDrop(

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc