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

@nightwatch/esbuild-utils

Package Overview
Dependencies
Maintainers
3
Versions
12
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@nightwatch/esbuild-utils - npm Package Compare versions

Comparing version 0.1.5 to 0.1.6

2

package.json

@@ -6,3 +6,3 @@ {

},
"version": "0.1.5",
"version": "0.1.6",
"description": "",

@@ -9,0 +9,0 @@ "main": "index.js",

@@ -19,2 +19,3 @@ const fs = require('fs');

'.txt': 'text',
'.mdx': 'text',
'.data': 'binary',

@@ -21,0 +22,0 @@

@@ -6,8 +6,22 @@ const path = require('path');

const getBrowserConsoleCode = `
const {Logger} = require('nightwatch');
let Logger;
try {
Logger = require('nightwatch').Logger;
} catch (err) {
Logger = {
inspectObject(obj) {
return obj;
},
colors: {
light_cyan: msg => (msg),
light_red: msg => (msg),
stack_trace: msg => (msg)
}
};
}
const {browserName = ''} = browser.capabilities;
if (browserName.toLowerCase() === 'chrome') {
const cdpConnection = await browser.driver.createCDPConnection('page');
if (browserName.toLowerCase() === 'chrome' || browserName.toLowerCase() === 'msedge') {
cdpConnection = await browser.driver.createCDPConnection('page');
cdpConnection._wsConnection.on('message', function(message) {

@@ -25,5 +39,7 @@ try {

const message = args.reduce((prev, item) => {
if (item.type === 'string') {
if (item.type === 'string' || item.type === 'boolean' || item.type === 'number') {
prev.push(item.value);
} else if (item.type === 'object') {
} else if (item === undefined) {
prev.push(undefined);
} else if (item.type === 'object' || item.type === 'function') {
prev.push(Logger.inspectObject({

@@ -33,2 +49,3 @@ [item.className]: item.description

}
return prev;

@@ -77,10 +94,15 @@ }, []);

const component = ${
exportName === 'default'
? `${path.basename(modulePath, path.extname(modulePath))}_${exportName}`
: exportName
};
const component = ${exportName === 'default' ? `${path.basename(modulePath, path.extname(modulePath)).replace(/-+/, '_')}_${exportName}` : exportName};
if (data.beforeMountError) {
console.error(data.beforeMountError.message);
}
if (component.test) {
await Promise.resolve(component.test(browser, data));
}
if (data.afterMountError) {
console.error(data.afterMountError.message);
}
}

@@ -107,12 +129,8 @@ );`;

const data = result === null || result === undefined ? {} : result;
const component = ${
exportName === 'default'
? `${path.basename(modulePath, path.extname(modulePath))}_${exportName}`
: exportName
};
if (component.test) {
return component.test(browser, data);
}
const component = ${exportName === 'default' ? `${path.basename(modulePath, path.extname(modulePath)).replace(/-+/, '_')}_${exportName}` : exportName};
if (component.test) {
return component.test(browser, data);
}
);`;
});`;
};

@@ -161,6 +179,7 @@

let componentDefault;
this.desiredCapabilities.pageLoadStrategy = this.argv.debug ? 'none' : 'eager';
let cdpConnection;
this.desiredCapabilities.pageLoadStrategy = 'eager';
this.skipTestcasesOnFail = false;
try {
componentDefault = ${path.basename(modulePath, path.extname(modulePath)).replace(/\./g, '_')}_default;
componentDefault = ${path.basename(modulePath, path.extname(modulePath)).replace(/[^a-zA-Z0-9]+/g, '_')}_default;

@@ -181,5 +200,11 @@ before(async function(browser) {

}
if (typeof componentDefault.after == 'function') {
after(componentDefault.after);
}
after(async function(browser) {
if (typeof componentDefault.after == 'function') {
after(componentDefault.after);
}
});
} catch (err) {

@@ -186,0 +211,0 @@ console.error('Error:', err);

@@ -35,5 +35,7 @@ const path = require('path');

const itBlocks = /it\(\n.+\n/g;
// const itBlocks = /it\(\n.+\n/g;
const itBlocks = /it\("exported [a-zA-Z]+", function\(browser\) {\n/g;
const matches = text.match(itBlocks);
assert.ok(!!matches, 'There are no matches for the "it" regex');
assert.strictEqual(matches.length, 4);

@@ -43,23 +45,20 @@ assert.ok(/describe\("Button\.stories\.jsx component", function\(\) {/.test(text));

const textToMatch = `it(
"exported Primary",
function(browser) {
const test = function() {
return function(browser2) {
browser2.init();
};
}({
data: { "exportName": "Primary", "modulePath": "${path.join(__dirname, '../data/Button.stories.jsx')}" },
publicUrl: "/test/data/Button.stories.jsx",
modulePath: "${path.join(__dirname, '../data/Button.stories.jsx')}",
exportName: "Primary"
});
const result = test(browser);
const data = result === null || result === void 0 ? {} : result;
const component = Primary;
if (component.test) {
return component.test(browser, data);
}
const textToMatch = `it("exported Primary", function(browser) {
const test = function() {
return function(browser2) {
browser2.init();
};
}({
data: { "exportName": "Primary", "modulePath": "${path.join(__dirname, '../data/Button.stories.jsx')}" },
publicUrl: "/test/data/Button.stories.jsx",
modulePath: "${path.join(__dirname, '../data/Button.stories.jsx')}",
exportName: "Primary"
});
const result = test(browser);
const data = result === null || result === void 0 ? {} : result;
const component = Primary;
if (component.test) {
return component.test(browser, data);
}
);`;
});`;

@@ -88,4 +87,3 @@ assert.ok(text.includes(textToMatch));

assert.ok(text.includes(`it(
const textToMatch = `it(
"exported Primary",

@@ -106,7 +104,15 @@ async function(browser) {

const component = Primary;
if (data.beforeMountError) {
console.error(data.beforeMountError.message);
}
if (component.test) {
await Promise.resolve(component.test(browser, data));
}
if (data.afterMountError) {
console.error(data.afterMountError.message);
}
}
);`));
);`;
assert.ok(text.includes(textToMatch));
});

@@ -113,0 +119,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