Skip to content

Commit

Permalink
cleanup, correctly using the new headless value in puppeteer
Browse files Browse the repository at this point in the history
  • Loading branch information
catdad committed Nov 19, 2023
1 parent e3a0f38 commit 1f750a9
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions test/index.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,15 @@ const PORT = 9999;
const width = 500;
const height = 500;

const args = ['--disable-background-timer-throttling'];

// Docker-based CIs need this disabled
// https://github.com/Quramy/puppeteer-example/blob/c28a5aa52fe3968c2d6cfca362ec28c36963be26/README.md#with-docker-based-ci-services
const args = process.env.CI ? [
'--no-sandbox', '--disable-setuid-sandbox'
] : [];
const headless = (process.env.CI || !('CONFETTI_SHOW' in process.env)) ? '--headless=new' : '';
if (process.env.CI) {
args.push('--no-sandbox', '--disable-setuid-sandbox');
}

const headless = (process.env.CI || !('CONFETTI_SHOW' in process.env)) ? 'new' : false;

const mkdir = async (dir) => {
return promisify(fs.mkdir)(dir)
Expand Down Expand Up @@ -60,7 +63,8 @@ const testBrowser = (() => {
}

return puppeteer.launch({
args: [ '--disable-background-timer-throttling', headless ].concat(args)
headless,
args
}).then(thisBrowser => {
browser = thisBrowser;
return Promise.resolve(browser);
Expand Down

0 comments on commit 1f750a9

Please sign in to comment.