Skip to content

Commit

Permalink
Fix playwright config merging for webServer property (#65090)
Browse files Browse the repository at this point in the history
  • Loading branch information
Ethan-Arrowood committed Apr 26, 2024
1 parent 8eb701c commit 0382162
Showing 1 changed file with 11 additions and 4 deletions.
15 changes: 11 additions & 4 deletions packages/next/src/experimental/testmode/playwright/index.ts
Expand Up @@ -19,10 +19,17 @@ export function defineConfig<T extends NextOptionsConfig, W>(
export function defineConfig<T extends NextOptionsConfig = NextOptionsConfig>(
config: base.PlaywrightTestConfig<T>
): base.PlaywrightTestConfig<T> {
return base.defineConfig<T>(
defaultPlaywrightConfig as base.PlaywrightTestConfig<T>,
config
)
if (config.webServer !== undefined) {
// Playwright doesn't merge the `webServer` field as we'd expect, so remove our default if the user specifies one.
const { webServer, ...partialDefaultPlaywrightConfig } =
defaultPlaywrightConfig as base.PlaywrightTestConfig<T>
return base.defineConfig<T>(partialDefaultPlaywrightConfig, config)
} else {
return base.defineConfig<T>(
defaultPlaywrightConfig as base.PlaywrightTestConfig<T>,
config
)
}
}

export type { NextFixture, NextOptions }
Expand Down

0 comments on commit 0382162

Please sign in to comment.