Skip to content

Commit 4aa9235

Browse files
committed
chore(playwright): add fast-fail mode for local debugging
Signed-off-by: Vitor Mattos <1079143+vitormattos@users.noreply.github.com>
1 parent 7a24929 commit 4aa9235

1 file changed

Lines changed: 11 additions & 7 deletions

File tree

playwright.config.ts

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,10 @@
55

66
import { defineConfig, devices } from '@playwright/test'
77

8+
const isCI = !!process.env.CI
9+
const forceFastFail = process.env.PLAYWRIGHT_FAST_FAIL === '1'
10+
const isDevelopmentFastFail = forceFastFail || (!isCI && process.env.PLAYWRIGHT_FAST_FAIL !== '0')
11+
812
/**
913
* See https://playwright.dev/docs/test-configuration.
1014
*/
@@ -14,15 +18,15 @@ export default defineConfig({
1418
/* Run tests in files in parallel */
1519
fullyParallel: true,
1620
/* Fail the build on CI if you accidentally left test.only in the source code. */
17-
forbidOnly: !!process.env.CI,
18-
/* Retry on CI only */
19-
retries: process.env.CI ? 2 : 0,
21+
forbidOnly: isCI,
22+
/* Retry on CI only, unless fast-fail is explicitly forced for local debugging. */
23+
retries: isDevelopmentFastFail ? 0 : (isCI ? 2 : 0),
2024
/* Opt out of parallel tests on CI. */
21-
workers: process.env.CI ? 1 : undefined,
25+
workers: isCI ? 1 : undefined,
2226
/* Reporter to use. See https://playwright.dev/docs/test-reporters */
23-
reporter: process.env.CI ? [['list'], ['github']] : 'list',
24-
/* Default timeout for each test (60 seconds) */
25-
timeout: 60000,
27+
reporter: isCI ? [['list'], ['github']] : 'list',
28+
/* Keep CI stable but allow fast-fail debugging locally via PLAYWRIGHT_FAST_FAIL=1. */
29+
timeout: isDevelopmentFastFail ? 30000 : 60000,
2630

2731
/* Shared settings for all the projects below. */
2832
use: {

0 commit comments

Comments
 (0)