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

@applitools/eyes.cypress

Package Overview
Dependencies
Maintainers
12
Versions
141
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@applitools/eyes.cypress - npm Package Compare versions

Comparing version 1.5.3 to 1.5.4

src/cypress/plugin/log.js

2

package.json
{
"name": "@applitools/eyes.cypress",
"version": "1.5.3",
"version": "1.5.4",
"main": "index.js",

@@ -5,0 +5,0 @@ "license": "MIT",

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

const configParams = require('./configParams');
const log = require('./log');

@@ -19,3 +20,3 @@ const configFilename = 'eyes.json';

} catch (ex) {
console.log(`no eyes.json config file found at ${configPath}`);
log(`no eyes.json config file found at ${configPath}`);
}

@@ -37,3 +38,3 @@

const ret = Object.assign({}, priorConfig, config);
console.log('running with config:', ret);
log(`running with config: ${JSON.stringify(ret)}`);
return ret;

@@ -40,0 +41,0 @@ };

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

const cors = require('cors');
const log = require('../../render-grid/sdk/log');
const log = require('./log');
const {promisify: p} = require('util');

@@ -38,3 +38,3 @@ const makeHandlers = require('./handlers');

app.use(cors());
app.use(morgan('combined'));
if (process.env.APPLITOOLS_DEV_MODE) app.use(morgan('combined'));
app.get('/hb', (_req, res) => res.sendStatus(200));

@@ -41,0 +41,0 @@ app.get('/err', (_req, res) => res.status(500).send('this is a test error'));

@@ -76,3 +76,3 @@ /* eslint-disable no-use-before-define */

} else {
console.log(`Unknown nodeType: ${nodeType}`);
// console.log(`Unknown nodeType: ${nodeType}`);
return null;

@@ -79,0 +79,0 @@ }

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

function extractCssResources(cssText, absoluteUrl) {
function extractCssResources(cssText, absoluteUrl, logger) {
let styleSheet;

@@ -36,3 +36,3 @@

} catch (ex) {
console.error(ex);
logger.log(ex);
return [];

@@ -39,0 +39,0 @@ }

'use strict';
const fetch = require('node-fetch');
const log = require('./log');
module.exports = url => {
log(`fetching ${url}`);
module.exports = (url, logger) => {
logger.log(`fetching ${url}`);
return fetch(url).then(resp =>

@@ -8,0 +7,0 @@ resp.buffer().then(buff => ({

@@ -33,7 +33,7 @@ 'use strict';

async function getDependantResources({url, type, value}, cache) {
async function getDependantResources({url, type, value}, cache, logger) {
let dependentResources, fetchedResources;
if (/text\/css/.test(type)) {
dependentResources = extractCssResources(value.toString(), url);
fetchedResources = await getOrFetchResources(dependentResources, cache);
dependentResources = extractCssResources(value.toString(), url, logger);
fetchedResources = await getOrFetchResources(dependentResources, cache, logger);
}

@@ -43,4 +43,4 @@ return {dependentResources, fetchedResources};

async function processResource(resource, cache) {
let {dependentResources, fetchedResources} = await getDependantResources(resource, cache);
async function processResource(resource, cache, logger) {
let {dependentResources, fetchedResources} = await getDependantResources(resource, cache, logger);
const rGridResource = fromFetchedToRGridResource(resource);

@@ -51,7 +51,7 @@ cache.add(resource.url, toCacheEntry(rGridResource), dependentResources);

async function getOrFetchResources(resourceUrls, cache, preResources = {}) {
async function getOrFetchResources(resourceUrls, cache, logger, preResources = {}) {
const resources = {};
for (const url in preResources) {
Object.assign(resources, await processResource(preResources[url], cache));
Object.assign(resources, await processResource(preResources[url], cache, logger));
}

@@ -71,4 +71,4 @@

missingResourceUrls.map(url =>
fetchResource(url).then(async resource =>
Object.assign(resources, await processResource(resource, cache)),
fetchResource(url, logger).then(async resource =>
Object.assign(resources, await processResource(resource, cache, logger)),
),

@@ -81,8 +81,8 @@ ),

function makeGetAllResources() {
function makeGetAllResources(logger = console) {
const cache = createResourceCache();
return async (absoluteUrls = [], preResources) =>
await getOrFetchResources(absoluteUrls, cache, preResources);
await getOrFetchResources(absoluteUrls, cache, logger, preResources);
}
module.exports = makeGetAllResources;

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

const saveData = require('../troubleshoot/saveData');
const {setIsVerbose} = require('./log');
const createRenderRequests = require('./createRenderRequests');

@@ -43,3 +42,3 @@ const renderBatch = require('./renderBatch');

const renderId = renderIds[index];
renderWrapper._logger.log(
logger.log(
`render request complete for ${renderId}. tag=${tag} sizeMode=${sizeMode} browser: ${JSON.stringify(

@@ -50,3 +49,3 @@ browsers[index],

const [screenshotUrl] = await waitForRenderedStatus([renderId], renderWrapper);
renderWrapper._logger.log(`screenshot available for ${renderId} at ${screenshotUrl}`);
logger.log(`screenshot available for ${renderId} at ${screenshotUrl}`);
await prevJobPromise;

@@ -71,3 +70,3 @@ results.push(await wrappers[index].checkWindow({screenshotUrl, tag}));

for (const renderId of renderIds) {
await saveData({renderId, cdt, resources, url});
await saveData({renderId, cdt, resources, url, logger});
}

@@ -126,5 +125,2 @@ }

/******* openEyes body start *******/
setIsVerbose(showLogs);
const getAllResources = makeGetAllResources();
let checkWindowPromises = [];

@@ -158,4 +154,4 @@ const results = [];

renderWrapper._logger.log('aaa');
renderWrapper._logger.verbose('bbb');
const logger = renderWrapper._logger;
const getAllResources = makeGetAllResources(logger);

@@ -162,0 +158,0 @@ return {

'use strict';
const log = require('../sdk/log');
const fs = require('fs');

@@ -14,4 +13,4 @@ const {promisify: p} = require('util');

async function saveData({renderId, cdt, resources, url}) {
log(`saving data for renderId=${renderId}`);
async function saveData({renderId, cdt, resources, url, logger}) {
logger.log(`saving data for renderId=${renderId}`);
const folderName = getFolderName(renderId, new Date());

@@ -22,3 +21,3 @@ const path = resolve(process.cwd(), '.applitools', folderName);

} catch (ex) {
log(`${path} already exists`);
logger.log(`${path} already exists`);
}

@@ -45,6 +44,6 @@ writeFile(resolve(path, 'cdt.json'), JSON.stringify(cdt));

const resourceName = getResourceName(resource);
log(`saving resource: ${resourceUrl} as ${resourceName}`);
logger.log(`saving resource: ${resourceUrl} as ${resourceName}`);
return writeFile(resolve(path, resourceName), content);
} else {
log(`NOT saving resource (missing content): ${resourceUrl}`);
logger.log(`NOT saving resource (missing content): ${resourceUrl}`);
return Promise.resolve();

@@ -51,0 +50,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