Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
it("dependencies is not the same", async function() {
const pluginSourcePath = path.join(__dirname, "my-plugin-with-diff-dep");
await manager.installFromPath(pluginSourcePath);
const pluginDebugInstance = manager.require("debug/package.json");
// tslint:disable-next-line:no-submodule-imports
const hostDebugInstance = require("debug/package.json");
assert.equal(pluginDebugInstance.version, "2.6.9");
assert.equal(hostDebugInstance.version.substring(0, 1), "4");
assert.notEqual(pluginDebugInstance.version, hostDebugInstance.version); // I expect to be different (v2 vs v3)
});
});
it("dependencies is not the same", async function() {
const pluginSourcePath = path.join(__dirname, "my-plugin-with-diff-dep");
await manager.installFromPath(pluginSourcePath);
const pluginDebugInstance = manager.require("debug/package.json");
// tslint:disable-next-line:no-submodule-imports
const hostDebugInstance = require("debug/package.json");
assert.equal(pluginDebugInstance.version, "2.6.9");
assert.equal(hostDebugInstance.version.substring(0, 1), "4");
assert.notEqual(pluginDebugInstance.version, hostDebugInstance.version); // I expect to be different (v2 vs v3)
});
});
openedPages: {},
/**
* Multiple browsers support
* @type {Boolean}
*/
isMultiBrowser: false,
/**
* Puppeteer initialization options
* @type {*}
* @private
*/
_options: {
ignoreHTTPSErrors: true,
headless: !debug.enabled('puppeteer'),
slowMo: debug.enabled('puppeteer') ? 250 : 0,
timeout: 60000,
dumpio: debug.enabled('puppeteer'),
// avoid issues in Travis
args: Env.isCI ? [ '--no-sandbox', '--disable-setuid-sandbox' ] : [],
},
/**
* Open new page in browser
* @param {String} id
* @param {String} pageUrl
* @returns {Promise}
*/
async openBrowser(id, pageUrl) {
const browser = await puppeteer.launch(this._options);
const debug = require('debug')
const util = require('util')
debug.recorded = []
// enable all logs while running the tests
debug.enable('thumbsup:*')
// don't format the logs to avoid any extra ANSI codes
debug.formatArgs = function (args) {
}
// capture the logs instead of displaying them
debug.log = function () {
const message = util.format.apply(null, arguments)
debug.recorded.push(`${this.namespace} ${message}`)
}
debug.reset = function () {
debug.recorded = []
}
debug.assertContains = function (expected) {
const matches = debug.recorded.filter(message => {
return message.includes(expected)
})
return __awaiter(this, void 0, void 0, function* () {
const pluginSourcePath = path.join(__dirname, "my-plugin-with-diff-dep");
yield manager.installFromPath(pluginSourcePath);
const pluginDebugInstance = manager.require("debug/package.json");
// tslint:disable-next-line:no-submodule-imports
const hostDebugInstance = require("debug/package.json");
chai_1.assert.equal(pluginDebugInstance.version, "2.6.9");
chai_1.assert.equal(hostDebugInstance.version.substring(0, 1), "4");
chai_1.assert.notEqual(pluginDebugInstance.version, hostDebugInstance.version); // I expect to be different (v2 vs v3)
});
});
return __awaiter(this, void 0, void 0, function* () {
const pluginSourcePath = path.join(__dirname, "my-plugin-with-diff-dep");
yield manager.installFromPath(pluginSourcePath);
const pluginDebugInstance = manager.require("debug/package.json");
// tslint:disable-next-line:no-submodule-imports
const hostDebugInstance = require("debug/package.json");
chai_1.assert.equal(pluginDebugInstance.version, "2.6.9");
chai_1.assert.equal(hostDebugInstance.version.substring(0, 1), "4");
chai_1.assert.notEqual(pluginDebugInstance.version, hostDebugInstance.version); // I expect to be different (v2 vs v3)
});
});
return (key: string) => (message: string) => {
if (typeof window.Raven === 'object') {
try {
Raven.captureBreadcrumb({
message: `${key} - ${message}`,
category: 'logging',
});
} catch (e) {
console.error(e);
}
}
};
}
const debug = require('debug'); // eslint-disable-line global-require
debug.enable('cs:*');
return debug;
};
async function onError (error: any): Promise {
// If debug is on, log the entire error object, otherwise log just the message
log('error', debug.enabled('rx:cli') ? error : error.message)
process.exit(1)
}
const Sentry = require('@sentry/electron')
const debug = require('debug').default('app:electron:telemetry:sentry')
const { settings } = require('../modules')
const instance = {
init() {
if (!this.can()) {
return
}
const config = {
dsn: process.env.SENTRY_DSN,
release: process.env.npm_package_version,
environment: process.env.NODE_ENV
}
// Send any error to Sentry
.catch(function () {
// silent failure
});
}
return idb.put(idb.stores.state, key, namespaces)
.catch(function (error) {
console.error('debug failed to save namespace', error);
});
};
/***
* Echo the functionality of debugLib.
* On module load, enable from storage.
*/
debugLib.load().then(function (namespaces) {
debugLib.enable(namespaces);
});
/**
* Wrap the main debugLib function
*
* @param {String} namespace
* @returns {Function} The debug function for chaining.
*/
export default function debugWrapper (namespace) {
return debugLib('sw:'+namespace);
}
// Mixin all debugLib props and methods
// eslint-disable-next-line no-unused-vars
for (let item in debugLib) {