diff --git a/docs/src/intro-js.md b/docs/src/intro-js.md index 30dbfb8abf087..4fbdf6c7665e4 100644 --- a/docs/src/intro-js.md +++ b/docs/src/intro-js.md @@ -22,7 +22,8 @@ Get started by installing Playwright using npm or yarn. Alternatively you can al values={[ {label: 'npm', value: 'npm'}, {label: 'yarn', value: 'yarn'}, - {label: 'pnpm', value: 'pnpm'} + {label: 'pnpm', value: 'pnpm'}, + {label: 'bun', value: 'bun'} ] }> @@ -47,6 +48,14 @@ yarn create playwright pnpm create playwright ``` + + + + +```bash +bunx create-playwright +``` + diff --git a/docs/src/test-components-js.md b/docs/src/test-components-js.md index 3aebace0ad0ce..b96df3ba63121 100644 --- a/docs/src/test-components-js.md +++ b/docs/src/test-components-js.md @@ -48,6 +48,7 @@ Adding Playwright Test to an existing project is easy. Below are the steps to en {label: 'npm', value: 'npm'}, {label: 'yarn', value: 'yarn'}, {label: 'pnpm', value: 'pnpm'}, + {label: 'bun', value: 'bun'}, ] }> @@ -72,8 +73,16 @@ yarn create playwright --ct pnpm dlx create-playwright --ct ``` - - + + + + +```bash +bunx create-playwright --ct +``` + + + This step creates several files in your workspace: @@ -150,7 +159,7 @@ declare module '*.vue'; ``` - + ```js @@ -314,7 +323,7 @@ This includes any config that needs to be run before or after mounting the compo - + ```js title="playwright/index.ts" import { beforeMount, afterMount } from '@playwright/experimental-ct-vue2/hooks'; import Router from 'vue-router'; @@ -378,7 +387,7 @@ import { defineConfig } from '@playwright/experimental-ct-react'; export default defineConfig({ use: { - ctViteConfig: { + ctViteConfig: { // ... }, }, @@ -439,7 +448,7 @@ test('should work', async ({ mount }) => { ``` - + ```js @@ -597,7 +606,7 @@ import Store from './Store.vue'; test('override initialState ', async ({ mount }) => { const component = await mount(Store, { hooksConfig: { - store: { name: 'override initialState' } + store: { name: 'override initialState' } } }); await expect(component).toContainText('override initialState'); diff --git a/packages/playwright-core/src/cli/cli.ts b/packages/playwright-core/src/cli/cli.ts index ac3cacff9d634..1bb8c763ca28d 100755 --- a/packages/playwright-core/src/cli/cli.ts +++ b/packages/playwright-core/src/cli/cli.ts @@ -41,6 +41,10 @@ function printPlaywrightTestError(command: string) { console.error(`Please install @playwright/test package before running "pnpm exec playwright ${command}"`); console.error(` pnpm remove ${packages.join(' ')}`); console.error(' pnpm add -D @playwright/test'); + } else if (packageManager === 'bun') { + console.error(`Please install @playwright/test package before running "bunx playwright ${command}"`); + console.error(` bun remove ${packages.join(' ')}`); + console.error(' bun add -D @playwright/test'); } else { console.error(`Please install @playwright/test package before running "npx playwright ${command}"`); console.error(` npm uninstall ${packages.join(' ')}`); diff --git a/packages/playwright-core/src/utils/env.ts b/packages/playwright-core/src/utils/env.ts index 27f10f384b126..ae969df9fcb9c 100644 --- a/packages/playwright-core/src/utils/env.ts +++ b/packages/playwright-core/src/utils/env.ts @@ -32,5 +32,7 @@ export function getPackageManager() { return 'yarn'; if (env.includes('pnpm')) return 'pnpm'; + if (env.includes('bun')) + return 'bun'; return 'npm'; }