Files
computer-playbook/utils/install/lint/playwright.py
kevinveenbirkenbachandClaude Opus 4.7 7ad7b5e76c feat(lint): add lint-playwright for per-role spec parse checks
Each role's Playwright spec is staged the same way `test-e2e-playwright` does at deploy time (central config + personas tree + service-gating) and `npx playwright test --list` runs against it. `--list` skips the browser launch and any test body, so this catches refactor regressions like missing helpers, broken exports, or syntax errors in seconds instead of waiting for a full deploy. Stub env values keyed off the variable-name suffix satisfy the few specs that build URLs or call `.replace()` at module-load time.

Parallelism caps at `INFINITO_WORKER_CPU` (same env knob as `scripts/make/parallel.sh`); output is replayed in `SPEC_FILES` order after all workers drain so stdout stays deterministic. `@playwright/test` ships as a devDep via the existing eslint `npm ci`. Workflow wires into `ci-orchestrator.yml` behind the `lint-gate`.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-22 10:24:32 +02:00

24 lines
726 B
Python

"""Install @playwright/test (locally in repo root via npm)."""
from __future__ import annotations
from pathlib import Path
from utils.cache import PROJECT_ROOT
from utils.install.npm import npm_install_local_in_repo
from utils.install.primitives import log
def ensure() -> None:
repo_root = Path(PROJECT_ROOT)
if (repo_root / "node_modules" / "@playwright" / "test").is_dir():
return
log("Missing local '@playwright/test'. Installing via npm (in repo root).")
npm_install_local_in_repo(str(repo_root))
if not (repo_root / "node_modules" / "@playwright" / "test").is_dir():
raise RuntimeError(
"Local '@playwright/test' is still unavailable after installation."
)