diff --git a/test/index.test.js b/test/index.test.js index 9da20ee..7b17650 100644 --- a/test/index.test.js +++ b/test/index.test.js @@ -13,13 +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 ? true : - process.env['CONFETTI_SHOW'] ? false : true; +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) @@ -62,7 +64,7 @@ const testBrowser = (() => { return puppeteer.launch({ headless, - args: [ '--disable-background-timer-throttling' ].concat(args) + args }).then(thisBrowser => { browser = thisBrowser; return Promise.resolve(browser); @@ -784,7 +786,7 @@ test('[text] shapeFromText can optionally render text in a requested color', asy // this test renders a black canvas in a headless browser // but works fine when it is not headless // eslint-disable-next-line ava/no-skip-test -(headless ? test.skip : test)('[text] shoots confetti of an emoji shape', async t => { +test('[text] shoots confetti of an emoji shape', async t => { const page = t.context.page = await fixturePage(); const fontFace = await loadFont(page); @@ -803,7 +805,7 @@ test('[text] shapeFromText can optionally render text in a requested color', asy }); t.context.image = await readImage(t.context.buffer); - t.is(t.context.image.hash(), '9CppCqpCmtC'); + t.is(t.context.image.hash(), 'cPpcSrcCjdC'); }); /*