Local CLI for generating additional Playwright tests.
This CLI uses ts-morph (TypeScript compiler API) with the repo’s tsconfig.json to do type-aware analysis. This gives us most of the benefits you get in the IDE via the TypeScript LSP (cross-file symbol resolution, path aliases like @pages/*, etc.) without needing to run an actual language server.
Pros (type-aware analysis):
- More robust than grep/regex across refactors and aliasing
- Can follow identifiers/spreads to where
_schemais defined
Cons:
- Slightly heavier startup (TypeScript project load)
Pure AST-only (no type checker) or grep can be faster to prototype, but tends to break once imports are aliased/re-exported or the same symbol name exists in multiple files.
From repo root (after npm i):
./node_modules/.bin/gremlin tests/8.9/login.spec.ts./node_modules/.bin/gremlin tests/8.9/login.spec.ts -o ./generated
The output path is printed to stdout.
Example (from repo root):
./node_modules/.bin/gremlin tests/8.9/login.spec.ts
# -> /absolute/path/to/.../tests/8.9/login-invalid-input-generated.spec.tsNotes:
- The generated file includes only generated tests (not a copy of the original tests).
- The CLI runs
eslint --fixand then Prettier on the generated file after writing it.