jwulf/gremlin

Negative test generator tool

★ 0Forks 0TypeScriptGitHub ↗Compare

README

gremlin

Local CLI for generating additional Playwright tests.

How it finds schemas (LSP vs AST/grep)

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 _schema is 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.

Usage

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.ts

Notes:

  • The generated file includes only generated tests (not a copy of the original tests).
  • The CLI runs eslint --fix and then Prettier on the generated file after writing it.

Contributors

jwulf

Issues