Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
*/
async function launchChrome(runnerOptions) {
let runner;
if (process.env.SHOW_CHROME) {
runner = await launchWithoutNoise(runnerOptions);
} else {
runner = await launchWithHeadless(runnerOptions);
}
return runner;
}
/**
* chrome remote interface protocols data, enable should enable protocols before use
*/
const DomainData = {};
ProtocolDomains.forEach((domain) => {
const { domain: name, events: domainEvents = [], commands: domainCommands = [] } = domain;
const hasEnableCommand = domainCommands.findIndex(({ name }) => name === 'enable') >= 0;
const events = domainEvents.map(({ name }) => name);
DomainData[name] = {
hasEnableCommand,
events,
}
});
/**
* ChromePool used to manage chrome tabs, for reuse tab
* use #new() static method to make a ChromePool, don't use new ChromePool()
* #new() is a async function, new ChromePool is useable util #ChromePool.new() to be completed
*/
class ChromePool {