feat: Switch project tooling from npm to bun and add enhanced pre-commit
checks - Replace npm commands with bun/bunx in scripts, docs, and CI - Add enhanced pre-commit checks with parallel execution - Document pre-commit hook behavior in PRE_COMMIT_HOOKS.md - Update .gitignore/.dockerignore for bun-debug.log - Refine ESLint config for bun and Prettier integration - Add scripts/type-check-staged.sh for fast staged type checks - Improve developer workflow and code quality automation
This commit is contained in:
@@ -64,8 +64,8 @@ tests/e2e/
|
||||
|
||||
```bash
|
||||
# Install Playwright and browsers
|
||||
npm install -D @playwright/test
|
||||
npx playwright install
|
||||
bun add -D @playwright/test
|
||||
bunx playwright install
|
||||
```
|
||||
|
||||
### 2. Update Package.json
|
||||
@@ -87,40 +87,40 @@ npx playwright install
|
||||
|
||||
```bash
|
||||
# Run all E2E tests
|
||||
npm run test:e2e
|
||||
bun run test:e2e
|
||||
|
||||
# Run tests in UI mode (interactive)
|
||||
npm run test:e2e:ui
|
||||
bun run test:e2e:ui
|
||||
|
||||
# Run specific test file
|
||||
npx playwright test auth.spec.ts
|
||||
bunx playwright test auth.spec.ts
|
||||
|
||||
# Run tests in debug mode
|
||||
npm run test:e2e:debug
|
||||
bun run test:e2e:debug
|
||||
```
|
||||
|
||||
### Browser-Specific Testing
|
||||
|
||||
```bash
|
||||
# Run on specific browser
|
||||
npx playwright test --project=chromium
|
||||
npx playwright test --project=firefox
|
||||
npx playwright test --project=webkit
|
||||
bunx playwright test --project=chromium
|
||||
bunx playwright test --project=firefox
|
||||
bunx playwright test --project=webkit
|
||||
|
||||
# Run on mobile browsers
|
||||
npx playwright test --project="Mobile Chrome"
|
||||
npx playwright test --project="Mobile Safari"
|
||||
bunx playwright test --project="Mobile Chrome"
|
||||
bunx playwright test --project="Mobile Safari"
|
||||
```
|
||||
|
||||
### Test Reporting
|
||||
|
||||
```bash
|
||||
# Generate and view HTML report
|
||||
npm run test:e2e:report
|
||||
bun run test:e2e:report
|
||||
|
||||
# Run with specific reporter
|
||||
npx playwright test --reporter=line
|
||||
npx playwright test --reporter=json
|
||||
bunx playwright test --reporter=line
|
||||
bunx playwright test --reporter=json
|
||||
```
|
||||
|
||||
## Test Configuration
|
||||
@@ -196,23 +196,23 @@ test('should add medication', async ({ adminPage }) => {
|
||||
|
||||
```bash
|
||||
# Debug specific test
|
||||
npx playwright test auth.spec.ts --debug
|
||||
bunx playwright test auth.spec.ts --debug
|
||||
|
||||
# Run with headed browser
|
||||
npx playwright test --headed
|
||||
bunx playwright test --headed
|
||||
|
||||
# Slow down execution
|
||||
npx playwright test --slow-mo=1000
|
||||
bunx playwright test --slow-mo=1000
|
||||
```
|
||||
|
||||
### CI/CD Integration
|
||||
|
||||
```bash
|
||||
# Run in CI mode
|
||||
CI=true npx playwright test
|
||||
CI=true bunx playwright test
|
||||
|
||||
# Generate artifacts for CI
|
||||
npx playwright test --reporter=github
|
||||
bunx playwright test --reporter=github
|
||||
```
|
||||
|
||||
## Adding New Tests
|
||||
@@ -273,13 +273,13 @@ export class NewFeatureHelpers {
|
||||
|
||||
```bash
|
||||
# Show browser developer tools
|
||||
npx playwright test --debug
|
||||
bunx playwright test --debug
|
||||
|
||||
# Record test execution
|
||||
npx playwright codegen localhost:8080
|
||||
bunx playwright codegen localhost:8080
|
||||
|
||||
# Trace viewer
|
||||
npx playwright show-trace trace.zip
|
||||
bunx playwright show-trace trace.zip
|
||||
```
|
||||
|
||||
## Continuous Integration
|
||||
@@ -295,9 +295,9 @@ jobs:
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
- uses: actions/setup-node@v3
|
||||
- run: npm ci
|
||||
- run: npx playwright install --with-deps
|
||||
- run: npm run test:e2e
|
||||
- run: bun install
|
||||
- run: bunx playwright install --with-deps
|
||||
- run: bun run test:e2e
|
||||
- uses: actions/upload-artifact@v3
|
||||
if: always()
|
||||
with:
|
||||
|
||||
Reference in New Issue
Block a user