From 1be3f9cbb4172b6a7c6791012fdd8a17262a649a Mon Sep 17 00:00:00 2001 From: Simon Holthausen Date: Mon, 13 Mar 2023 18:35:56 +0100 Subject: [PATCH] try to deflake tests --- test/runtime-puppeteer/index.ts | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/test/runtime-puppeteer/index.ts b/test/runtime-puppeteer/index.ts index eba60544f6..d9fc58f8a7 100644 --- a/test/runtime-puppeteer/index.ts +++ b/test/runtime-puppeteer/index.ts @@ -57,8 +57,6 @@ async function launchPuppeteer() { const assert = fs.readFileSync(`${__dirname}/assert.js`, 'utf-8'); describe('runtime (puppeteer)', function() { - // Note: Increase the timeout in preparation for restarting Chromium due to SIGSEGV. - this.timeout(10000); before(async () => { svelte = loadSvelte(false); console.log('[runtime-puppeteer] Loaded Svelte'); @@ -75,7 +73,7 @@ describe('runtime (puppeteer)', function() { const failed = new Set(); - function runTest(dir, hydrate) { + function runTest(dir, hydrate, is_first_run) { if (dir[0] === '.') return; // MEMO: puppeteer can not execute Chromium properly with Node8,10 on Linux at GitHub actions. const { version } = process; @@ -254,11 +252,14 @@ describe('runtime (puppeteer)', function() { prettyPrintPuppeteerAssertionError(err.message); assertWarnings(); }); - }); + }).timeout(is_first_run ? 20000 : 10000); } + // Increase the timeout on the first run in preparation for restarting Chromium due to SIGSEGV. + let first_run = true; fs.readdirSync(`${__dirname}/samples`).forEach(dir => { - runTest(dir, false); - runTest(dir, true); + runTest(dir, false, first_run); + runTest(dir, true, first_run); + first_run = false; }); });