From dde569b97d31f036b5b08c4250d5c752beabadd7 Mon Sep 17 00:00:00 2001 From: Nikolay Vitkov <34244704+Lightning00Blade@users.noreply.github.com> Date: Wed, 7 Jun 2023 10:18:01 +0200 Subject: [PATCH] ci: fix flaky test (#10335) --- .mocharc.cjs | 6 +++++- .vscode/launch.template.json | 5 ++++- test/src/network.spec.ts | 4 +++- 3 files changed, 12 insertions(+), 3 deletions(-) diff --git a/.mocharc.cjs b/.mocharc.cjs index d2b798bc..8414501c 100644 --- a/.mocharc.cjs +++ b/.mocharc.cjs @@ -14,6 +14,10 @@ * limitations under the License. */ +let timeout = process.platform === 'win32' ? 20_000 : 10_000; +if (!!process.env.DEBUGGER_ATTACHED) { + timeout = 0; +} module.exports = { reporter: 'dot', logLevel: 'debug', @@ -22,6 +26,6 @@ module.exports = { exit: !!process.env.CI, retries: process.env.CI ? 3 : 0, parallel: !!process.env.PARALLEL, - timeout: process.platform === 'win32' ? 20_000 : 10_000, + timeout: timeout, reporter: process.env.CI ? 'spec' : 'dot', }; diff --git a/.vscode/launch.template.json b/.vscode/launch.template.json index cdd05181..4fe7e194 100644 --- a/.vscode/launch.template.json +++ b/.vscode/launch.template.json @@ -37,7 +37,10 @@ "--no-coverage", "--no-suggestions" ], - "outFiles": ["${workspaceFolder}/**/*.js"] + "outFiles": ["${workspaceFolder}/**/*.js"], + "env": { + "DEBUGGER_ATTACHED": true + } } ] } diff --git a/test/src/network.spec.ts b/test/src/network.spec.ts index 65403c9b..02f9782a 100644 --- a/test/src/network.spec.ts +++ b/test/src/network.spec.ts @@ -819,7 +819,9 @@ describe('network', function () { }); const [response] = await Promise.all([ - waitEvent(page, 'response'), + waitEvent(page, 'response', res => { + return !isFavicon(res); + }), page.evaluate(() => { const xhr = new XMLHttpRequest(); xhr.open('GET', '/foo');