feat: initial dev-configs monorepo
Shared configs for TypeScript projects: ESLint, Prettier, TypeScript, Vite, Jest, Playwright, Knip. Published as @vigdorov/* npm packages to Gitea registry. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
19
packages/playwright/package.json
Normal file
19
packages/playwright/package.json
Normal file
@ -0,0 +1,19 @@
|
||||
{
|
||||
"name": "@vigdorov/playwright-config",
|
||||
"version": "1.0.0",
|
||||
"description": "Shared Playwright configuration",
|
||||
"type": "module",
|
||||
"main": "dist/index.js",
|
||||
"types": "dist/index.d.ts",
|
||||
"files": ["dist"],
|
||||
"scripts": {
|
||||
"build": "tsc"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"@playwright/test": ">=1.40.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@playwright/test": "^1.52.0",
|
||||
"typescript": "^5.8.3"
|
||||
}
|
||||
}
|
||||
29
packages/playwright/src/index.ts
Normal file
29
packages/playwright/src/index.ts
Normal file
@ -0,0 +1,29 @@
|
||||
import type {PlaywrightTestConfig} from '@playwright/test';
|
||||
|
||||
export interface PlaywrightConfigOptions {
|
||||
baseURL: string;
|
||||
testDir?: string;
|
||||
retries?: number;
|
||||
}
|
||||
|
||||
export function playwrightConfig(options: PlaywrightConfigOptions): PlaywrightTestConfig {
|
||||
const {baseURL, testDir = 'e2e', retries} = options;
|
||||
const isCI = !!process.env.CI;
|
||||
|
||||
return {
|
||||
testDir,
|
||||
timeout: 30_000,
|
||||
retries: retries ?? (isCI ? 2 : 0),
|
||||
reporter: isCI ? 'html' : 'list',
|
||||
use: {
|
||||
baseURL,
|
||||
trace: 'on-first-retry',
|
||||
screenshot: 'only-on-failure',
|
||||
},
|
||||
projects: [
|
||||
{name: 'chromium', use: {browserName: 'chromium'}},
|
||||
{name: 'firefox', use: {browserName: 'firefox'}},
|
||||
{name: 'webkit', use: {browserName: 'webkit'}},
|
||||
],
|
||||
};
|
||||
}
|
||||
8
packages/playwright/tsconfig.json
Normal file
8
packages/playwright/tsconfig.json
Normal file
@ -0,0 +1,8 @@
|
||||
{
|
||||
"extends": "../../tsconfig.base.json",
|
||||
"compilerOptions": {
|
||||
"outDir": "dist",
|
||||
"rootDir": "src"
|
||||
},
|
||||
"include": ["src"]
|
||||
}
|
||||
Reference in New Issue
Block a user