-
Notifications
You must be signed in to change notification settings - Fork 40
Expand file tree
/
Copy pathplaywright.config.ts
More file actions
32 lines (29 loc) · 935 Bytes
/
playwright.config.ts
File metadata and controls
32 lines (29 loc) · 935 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
import type { PlaywrightTestConfig } from "@playwright/test";
const getCommand = (type?: string): string => {
switch (type) {
case "dev":
return "pnpm ladle serve";
case "prod":
return "pnpm ladle build && pnpm ladle preview";
default:
throw new Error(`Unknown type: ${type}`);
}
};
const config: PlaywrightTestConfig = {
testMatch: "examples/**/*.spec.ts",
// Fail the build on CI if you accidentally left test.only in the source code.
forbidOnly: !!process.env.CI,
// Retry on CI only.
retries: process.env.CI ? 2 : 0,
// Opt out of parallel tests on CI.
workers: process.env.CI ? 1 : undefined,
use: {
baseURL: `http://127.0.0.1:${process.env.TYPE === "dev" ? 61000 : 8080}`,
},
webServer: {
reuseExistingServer: true,
command: getCommand(process.env.TYPE),
url: `http://127.0.0.1:${process.env.TYPE === "dev" ? 61000 : 8080}`,
},
};
export default config;