From 69703cc882678351e2c6e53270e14618b2199d28 Mon Sep 17 00:00:00 2001 From: Pavel Feldman Date: Tue, 29 Apr 2025 08:53:03 -0700 Subject: [PATCH] chore: follow up to exposing playwright config options (#289) --- config.d.ts | 1 + src/config.ts | 3 ++- src/tools/install.ts | 2 +- tests/fixtures.ts | 1 + 4 files changed, 5 insertions(+), 2 deletions(-) diff --git a/config.d.ts b/config.d.ts index 4de3571..d0c8e19 100644 --- a/config.d.ts +++ b/config.d.ts @@ -30,6 +30,7 @@ export type Config = { /** * Path to a user data directory for browser profile persistence. + * Temporary directory is created by default. */ userDataDir?: string; diff --git a/src/config.ts b/src/config.ts index 4001655..8b302fd 100644 --- a/src/config.ts +++ b/src/config.ts @@ -87,6 +87,7 @@ export async function configFromCLIOptions(cliOptions: CLIOptions): Promise { try { return JSON.parse(await fs.promises.readFile(configFile, 'utf8')); } catch (error) { - throw new Error(`Failed to load config file: ${configFile}`); + throw new Error(`Failed to load config file: ${configFile}, ${error}`); } } diff --git a/src/tools/install.ts b/src/tools/install.ts index 174dab1..11c9ca6 100644 --- a/src/tools/install.ts +++ b/src/tools/install.ts @@ -29,7 +29,7 @@ const install = defineTool({ }, handle: async context => { - const channel = context.config.browser?.launchOptions?.channel ?? context.config.browser?.launchOptions.channel ?? context.config.browser?.launchOptions.browserName ?? 'chrome'; + const channel = context.config.browser?.launchOptions?.channel ?? context.config.browser?.launchOptions.browserName ?? 'chrome'; const cli = path.join(require.resolve('playwright/package.json'), '..', 'cli.js'); const child = fork(cli, ['install', channel], { stdio: 'pipe', diff --git a/tests/fixtures.ts b/tests/fixtures.ts index ce8b03f..679187a 100644 --- a/tests/fixtures.ts +++ b/tests/fixtures.ts @@ -97,6 +97,7 @@ export const test = baseTest.extend({ `--no-first-run`, `--no-sandbox`, `--headless`, + '--use-mock-keychain', `data:text/html,hello world`, ], { stdio: 'pipe',