playwright: only add currents reporter if requisite env is set

This commit is contained in:
Sanne Raymaekers 2025-03-19 13:50:57 +01:00 committed by Klara Simickova
parent 5e7a9a3b7b
commit 94206fcac3

View file

@ -1,4 +1,13 @@
import { defineConfig, devices } from '@playwright/test';
import { defineConfig, devices, type ReporterDescription } from '@playwright/test';
const reporters: ReporterDescription[] = [
['html'],
['list'],
];
if (process.env.CURRENTS_PROJECT_ID && process.env.CURRENTS_RECORD_KEY) {
reporters.push(['@currents/playwright']);
}
export default defineConfig({
testDir: 'playwright',
@ -6,11 +15,7 @@ export default defineConfig({
workers: 1,
forbidOnly: !!process.env.CI,
retries: process.env.CI ? 1 : 0,
reporter: [
['html'],
['list'],
['@currents/playwright'],
],
reporter: reporters,
use: {
headless: true,
baseURL: process.env.BASE_URL ? process.env.BASE_URL : 'http://127.0.0.1:9090',