-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathindex.js
executable file
·35 lines (31 loc) · 910 Bytes
/
index.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
const { NOISE_FLAGS, HEADLESS_FLAGS } = require('./lib/flags');
const Runner = require('./lib/runner');
async function launch(runnerOptions = {}) {
const runner = new Runner(runnerOptions);
await runner.launch();
return runner;
}
async function launchWithoutNoise(runnerOptions = {}) {
let chromeFlags = NOISE_FLAGS;
if (Array.isArray(runnerOptions.chromeFlags)) {
chromeFlags = chromeFlags.concat(runnerOptions.chromeFlags);
}
return launch(Object.assign(runnerOptions, {
chromeFlags,
}));
}
async function launchWithHeadless(runnerOptions = {}) {
let chromeFlags = NOISE_FLAGS.concat(HEADLESS_FLAGS);
if (Array.isArray(runnerOptions.chromeFlags)) {
chromeFlags = chromeFlags.concat(runnerOptions.chromeFlags);
}
return launch(Object.assign(runnerOptions, {
chromeFlags,
}));
}
module.exports = {
Runner,
launch,
launchWithoutNoise,
launchWithHeadless
};