testform fmt
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.
Command Options
Section titled “Command Options”| 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. |
Real Execution Example
Section titled “Real Execution Example”$ testform fmttests/auth/login.case.featuretests/checkout/cart.case.feature
2 files reformatted.CI/CD Linter Mode (-check)
Section titled “CI/CD Linter Mode (-check)”In automated pull request workflows, run:
testform fmt -checkIf any developer submitted unformatted Gherkin code, the command exits with code 3 and prints the offending file paths.
Exit Codes
Section titled “Exit Codes”0: All files formatted (or already formatted when running with-check).1: Error processing files.3: Files require formatting (only when running with-check).