Expose headless flag
This commit is contained in:
+7
-2
@@ -181,7 +181,7 @@ async function renderEach(page, entries, options) {
|
|||||||
async function render(entries, options) {
|
async function render(entries, options) {
|
||||||
const browser = await puppeteer.launch({
|
const browser = await puppeteer.launch({
|
||||||
args: options.puppeteerArgs,
|
args: options.puppeteerArgs,
|
||||||
headless: !process.env.CI
|
headless: options.headless
|
||||||
});
|
});
|
||||||
|
|
||||||
let fail = false;
|
let fail = false;
|
||||||
@@ -304,8 +304,13 @@ if (require.main === module) {
|
|||||||
choices: ['trace', 'debug', 'info', 'warn', 'error', 'silent'],
|
choices: ['trace', 'debug', 'info', 'warn', 'error', 'silent'],
|
||||||
default: 'error'
|
default: 'error'
|
||||||
}).
|
}).
|
||||||
|
option('headless', {
|
||||||
|
describe: 'Launch Puppeteer in headless mode',
|
||||||
|
type: 'boolean',
|
||||||
|
default: process.env.CI ? false : true
|
||||||
|
}).
|
||||||
option('puppeteer-args', {
|
option('puppeteer-args', {
|
||||||
describe: 'Args of for puppeteer.launch()',
|
describe: 'Additional args for Puppeteer',
|
||||||
type: 'array',
|
type: 'array',
|
||||||
default: process.env.CI ? ['--no-sandbox', '--disable-setuid-sandbox'] : []
|
default: process.env.CI ? ['--no-sandbox', '--disable-setuid-sandbox'] : []
|
||||||
}).
|
}).
|
||||||
|
|||||||
Reference in New Issue
Block a user