Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@applitools/rendering-grid-client

Package Overview
Dependencies
Maintainers
12
Versions
34
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@applitools/rendering-grid-client - npm Package Compare versions

Comparing version 3.0.2 to 4.0.1

src/sdk/batchEnd.js

2

package.json
{
"name": "@applitools/rendering-grid-client",
"version": "3.0.2",
"version": "4.0.1",
"description": "",

@@ -5,0 +5,0 @@ "main": "src/rendering-grid-client.js",

@@ -28,3 +28,2 @@ 'use strict';

renderWrapper,
results,
}) {

@@ -123,5 +122,3 @@ return async function checkWindow({

results.push(
await wrapper.checkWindow({screenshotUrl: imageLocation, tag, domUrl, checkSettings}),
);
await wrapper.checkWindow({screenshotUrl: imageLocation, tag, domUrl, checkSettings});
}

@@ -128,0 +125,0 @@

'use strict';
function makeCloseEyes({getError, logger, getCheckWindowPromises, wrappers, results}) {
function makeCloseEyes({getError, logger, getCheckWindowPromises, wrappers}) {
return async function closeEyes() {

@@ -15,8 +15,3 @@ let error;

}
await Promise.all(wrappers.map(wrapper => wrapper.close()));
if ((error = getError())) {
logger.log('closeEyes() aborting after close');
throw error;
}
return results;
return await Promise.all(wrappers.map(wrapper => wrapper.close()));
};

@@ -23,0 +18,0 @@ }

@@ -34,6 +34,8 @@ 'use strict';

logger.log(`running with initial config: ${JSON.stringify(initialConfig)}`);
return {
getConfig(config) {
const ret = Object.assign({}, priorConfig, config);
logger.log(`running with config: ${JSON.stringify(ret)}`);
logger.log(`getConfig ${JSON.stringify(ret)}`);
return ret;

@@ -40,0 +42,0 @@ },

@@ -16,3 +16,3 @@ 'use strict';

function makeOpenEyes({getError, setError, getClosePromises}) {
function makeOpenEyes({getError, setError, handleClosePromise}) {
return async function openEyes({

@@ -63,4 +63,2 @@ appName,

let checkWindowPromises = [];
const results = [];
let error;

@@ -106,5 +104,5 @@ const browsers = Array.isArray(browser) ? browser : [browser];

if (err.response && err.response.status === 401) {
throw new Error('Unauthorized access to Eyes server. Please check your API key.');
setError(new Error('Unauthorized access to Eyes server. Please check your API key.'));
} else {
throw err;
setError(err);
}

@@ -147,6 +145,5 @@ });

renderWrapper,
results,
});
const closeEyes = makeCloseEyes({getError, logger, getCheckWindowPromises, wrappers, results});
const closeEyes = makeCloseEyes({getError, logger, getCheckWindowPromises, wrappers});

@@ -173,10 +170,5 @@ return {

async function close() {
if (error) {
logger.log('close() aborting when started');
throw error;
}
const promise = closeEyes().catch(setError);
getClosePromises().push(promise);
return promise;
const closePromise = closeEyes();
handleClosePromise(closePromise);
return closePromise;
}

@@ -183,0 +175,0 @@ };

@@ -5,44 +5,21 @@ 'use strict';

const makeOpenEyes = require('./openEyes');
const makeBatchEnd = require('./batchEnd');
const {presult} = require('@applitools/functional-commons');
function makeRenderingGridClient({
getConfig,
updateConfig,
getInitialConfig,
showLogs: globalShowLogs,
}) {
function makeRenderingGridClient({getConfig, updateConfig, getInitialConfig, showLogs}) {
let error;
let closePromises = [];
const globalLogger = createLogger(globalShowLogs);
const openEyes = makeOpenEyes({setError, getError, getClosePromises});
const logger = createLogger(showLogs);
const openEyes = makeOpenEyes({setError, getError, handleClosePromise});
const batchEnd = makeBatchEnd({logger, closePromises, getError});
const defaultBatch = getBatch(getInitialConfig());
logger.log('new default batch', defaultBatch);
updateConfig(defaultBatch);
return {
openEyes: openEyesWithConfig,
batchStart,
batchEnd,
};
function batchStart() {
error = null;
closePromises = [];
const defaultBatch = getBatch(getInitialConfig());
globalLogger.log('new default batch', defaultBatch);
updateConfig(defaultBatch);
}
async function batchEnd() {
if (error) {
globalLogger.log('batchEnd() aborting when started');
throw error;
}
const results = await Promise.all(closePromises);
if (error) {
globalLogger.log('batchEnd() aborting after closes');
throw error;
}
return results;
}
function setError(err) {

@@ -56,4 +33,5 @@ error = err;

function getClosePromises() {
return closePromises;
function handleClosePromise(promise) {
const handledPromise = presult(promise);
closePromises.push(handledPromise);
}

@@ -60,0 +38,0 @@

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