Skip to content

testform fmt

Ventana de terminal
testform fmt [options] [target-directory]

The testform fmt command rewrites Gherkin .feature files to adhere to canonical styling guidelines. It normalizes indentation, aligns step keywords (Given/When/Then), formats step tables, and cleans trailing whitespace.

Option Default Description
-check false Checks whether files are formatted without overwriting them. Emits exit code 3 if formatting changes are needed (ideal for CI linters).
-diff false Displays unified diffs of formatting changes.
-recursive true Recursively formats all subdirectories.
Ventana de terminal
$ testform fmt
tests/auth/login.case.feature
tests/checkout/cart.case.feature
2 files reformatted.

In automated pull request workflows, run:

Ventana de terminal
testform fmt -check

If any developer submitted unformatted Gherkin code, the command exits with code 3 and prints the offending file paths.

  • 0: All files formatted (or already formatted when running with -check).
  • 1: Error processing files.
  • 3: Files require formatting (only when running with -check).