diff --git a/packages/playwright/src/common/configLoader.ts b/packages/playwright/src/common/configLoader.ts index 4d72ed73a0..9d648ed0ea 100644 --- a/packages/playwright/src/common/configLoader.ts +++ b/packages/playwright/src/common/configLoader.ts @@ -48,6 +48,9 @@ export const defineConfig = (...configs: any[]) => { ] }; + if (!result.projects && !config.projects) + continue; + const projectOverrides = new Map(); for (const project of config.projects || []) projectOverrides.set(project.name, project); diff --git a/tests/playwright-test/config.spec.ts b/tests/playwright-test/config.spec.ts index bddbde5f57..fb2f1888d2 100644 --- a/tests/playwright-test/config.spec.ts +++ b/tests/playwright-test/config.spec.ts @@ -546,6 +546,9 @@ test('should merge configs', async ({ runInlineTest }) => { command: 'echo 123', }] })); + + // Should not add an empty project list. + expect(defineConfig({}, {}).projects).toBeUndefined(); `, 'a.test.ts': ` import { test } from '@playwright/test';