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.2 to 0.1.3

2

package.json

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

},
"version": "0.1.2",
"version": "0.1.3",
"description": "",

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

@@ -5,2 +5,57 @@ const path = require('path');

const getBrowserConsoleCode = `
const {Logger} = require('nightwatch');
const {browserName = ''} = browser.capabilities;
if (browserName.toLowerCase() === 'chrome') {
const cdpConnection = await browser.driver.createCDPConnection('page');
cdpConnection._wsConnection.on('message', function(message) {
try {
const params = JSON.parse(message);
if (params.method === 'Runtime.consoleAPICalled') {
const consoleEventParams = params['params'];
const {type, args} = consoleEventParams;
if (args.length > 0 && args[0].type === 'string' && args[0].value.startsWith('%c')) {
return;
}
const message = args.reduce((prev, item) => {
if (item.type === 'string') {
prev.push(item.value);
} else if (item.type === 'object') {
prev.push(Logger.inspectObject({
[item.className]: item.description
}));
}
return prev;
}, []);
if (typeof console[type] == 'function') {
console[type](Logger.colors.light_cyan('[browser]'), ...message);
}
}
if (params.method === 'Runtime.exceptionThrown') {
const exceptionEventParams = params['params'];
const {exceptionDetails = {}, timestamp} = exceptionEventParams;
const {exception} = exceptionDetails;
if (exception && exception.description) {
const stackParts = exception.description.split('\\n');
const errorTitle = stackParts.shift();
const stackTrace = stackParts.join('\\n');
console.error(Logger.colors.light_cyan('[browser]'), Logger.colors.light_red(errorTitle) + '\\n' + Logger.colors.stack_trace(stackTrace));
}
}
} catch (err) {
console.error(err);
}
});
cdpConnection.execute('Runtime.enable', {}, null);
}
`;
const itFnAsync = function({name, exportName, createTest, onlyConditionFn = function() {}, modulePath, additionalTestData, modulePublicUrl}, argv) {

@@ -17,4 +72,4 @@ return `

const element = await Promise.resolve(test(browser));
const data = element === null || element === undefined ? {} : {component: element};
const mountResult = await Promise.resolve(test(browser));
const data = mountResult || {};

@@ -26,3 +81,2 @@ const component = ${

};
if (component.test) {

@@ -72,3 +126,3 @@ await Promise.resolve(component.test(browser, data));

*/
module.exports = async function (modulePath, {name, data, exports, createTest, transformCode = (code) => code, onlyConditionFn}, {
module.exports = async function (modulePath, {name, data, showBrowserConsole = false, exports, createTest, transformCode = (code) => code, onlyConditionFn}, {
argv = {}, nightwatch_settings = {}

@@ -97,3 +151,3 @@ }) {

const opts = {
exportName, name, createTest, additionalTestData, modulePath, onlyConditionFn, modulePublicUrl
exportName, name, showBrowserConsole, createTest, additionalTestData, modulePath, onlyConditionFn, modulePublicUrl
};

@@ -104,2 +158,3 @@

const browserConsoleCode = showBrowserConsole ? getBrowserConsoleCode: '';
const describeFn = `describe('${path.basename(modulePath)} component', function () {

@@ -111,5 +166,10 @@ let componentDefault;

if (typeof componentDefault.before == 'function') {
before(componentDefault.before);
}
before(async function(browser) {
${browserConsoleCode}
if (typeof componentDefault.before == 'function') {
await componentDefault.before(browser);
}
});
if (typeof componentDefault.beforeEach == 'function') {

@@ -116,0 +176,0 @@ beforeEach(componentDefault.beforeEach);

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