Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
'use strict';
const net = require('net');
const { launchWithHeadless, launchWithoutNoise } = require('chrome-runner');
const chrome = require('chrome-remote-interface');
const ProtocolDomains = require('chrome-remote-interface/lib/protocol.json').domains;
/**
* launch Chrome
*/
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