@aippt/gherkin-fmt (0.1.0)
Installation
@aippt:registry=npm install @aippt/gherkin-fmt@0.1.0"@aippt/gherkin-fmt": "0.1.0"About this package
gherkin-fmt
Opinionated formatter for Gherkin .feature files.
It supports localized Gherkin, Features, Rules, Backgrounds, Scenarios, Scenario Outlines, Examples, descriptions, tags, comments, data tables, doc strings, and steps with multiple arguments. Formatting is idempotent and preserves the parsed meaning of the document.
Usage
Configure the registry and install the package:
@aippt:registry=https://git.productteams.ai/api/packages/aippt/npm/
pnpm add --save-dev @aippt/gherkin-fmt
Format files or directories recursively:
pnpm exec gherkin-fmt features/
Check formatting without changing files:
pnpm exec gherkin-fmt --check features/
Format standard input to standard output:
pnpm exec gherkin-fmt - <input.feature >output.feature
--check exits with status 1 when any input would change. Parse and filesystem errors also exit 1;
missing input paths exit 2. Directory traversal is deterministic, ignores symbolic links, and
deduplicates files reached through overlapping input paths.
Library
The package also exports the formatter as a library:
import { format } from '@aippt/gherkin-fmt'
const formatted = format(source)
Formatting policy
- Indentation is two spaces per Gherkin level.
- Feature children and Rule children are separated by two blank lines.
- Descriptions and intentionally blank-separated step groups are retained.
- Tags stay grouped according to their original tag lines.
- Comments retain their order and position relative to descriptions, tags, steps, and table rows.
- Data tables are aligned by display width and escaped cell values remain semantically equivalent.
- Doc-string delimiters, content types, content indentation, and argument order are retained.
- Nonempty output uses LF line endings, has no trailing whitespace, and ends in one newline.
Development
Open the repository in its dev container, then:
vp install
vp check
vp test
vp run package
vp node src/cli.ts
Dependencies
Dependencies
| ID | Version |
|---|---|
| @cucumber/gherkin | 42.0.1 |
| @cucumber/messages | 34.2.1 |
Development dependencies
| ID | Version |
|---|---|
| @types/node | 26.1.1 |
| @vitest/coverage-v8 | 4.1.11 |
| node | runtime:26.8.1 |
| publint | 0.3.23 |
| typescript | 7.0.2 |
| vite | npm:@voidzero-dev/vite-plus-core@0.3.0 |
| vite-plus | 0.3.0 |