From d92c8c221a59a9d92a233395b082590841c20bce Mon Sep 17 00:00:00 2001 From: Yusuke Wada Date: Thu, 21 Nov 2024 03:06:16 +0900 Subject: [PATCH] add the test for vite in `examples/cloudflare-workers` --- examples/cloudflare-workers/package.json | 1 + .../playwright-vite.config.ts | 26 +++++++++++++++++++ 2 files changed, 27 insertions(+) create mode 100644 examples/cloudflare-workers/playwright-vite.config.ts diff --git a/examples/cloudflare-workers/package.json b/examples/cloudflare-workers/package.json index 6fa5e20..4b70814 100644 --- a/examples/cloudflare-workers/package.json +++ b/examples/cloudflare-workers/package.json @@ -10,6 +10,7 @@ "start": "wrangler dev", "typecheck": "tsc", "preview": "npm run build && wrangler dev", + "test:e2e:vite": "playwright test -c playwright-vite.config.ts e2e.test.ts", "test:e2e:workers": "npm run build && playwright test -c playwright-workers.config.ts e2e.test.ts" }, "dependencies": { diff --git a/examples/cloudflare-workers/playwright-vite.config.ts b/examples/cloudflare-workers/playwright-vite.config.ts new file mode 100644 index 0000000..af0c1ec --- /dev/null +++ b/examples/cloudflare-workers/playwright-vite.config.ts @@ -0,0 +1,26 @@ +import { defineConfig, devices } from '@playwright/test' + +const port = 6173 + +export default defineConfig({ + fullyParallel: true, + forbidOnly: !!process.env.CI, + retries: process.env.CI ? 2 : 0, + workers: process.env.CI ? 1 : undefined, + use: { + baseURL: `http://localhost:${port.toString()}`, + }, + projects: [ + { + name: 'chromium', + use: { ...devices['Desktop Chrome'] }, + timeout: 5000, + retries: 2, + }, + ], + webServer: { + command: `npm exec vite -- --port ${port.toString()} -c ./vite.config.ts`, + port, + reuseExistingServer: !process.env.CI, + }, +})