Gherkin
Gherkin validation
Section titled “Gherkin validation”vitest-cucumber uses its own feature file parser and validate it before running unit tests.
And check ths tests for all scenario, steps, etc.
Before unit tests run
Section titled “Before unit tests run”When you call loadFeature, vitest-cucumber parses and validates your feature file.
It implements gherkin keywords:
ScenarioScenario OutlineFeatureExamplesRule- Steps :
Given,When,Then,And,But
Since 3.3.2 version you can use Example, Scenarios and Scenario Template synonyms.
Validation
Section titled “Validation”When vitest-cucumber parses your feature file, it checks that:
- You have an
Examplesin yourScenario Outline - You use
Examplesvariables in yourScenario Outlinesteps
After unit tests run
Section titled “After unit tests run”Validation
Section titled “Validation”After all unit tests vitest-cucumber, it checks:
- non tested
Scenarioand/orScenario Outline - non tested
Scenarioand/orScenario Outlinesteps - non tested
Feature - non tested
Rule
Generate spec file from feature file
Section titled “Generate spec file from feature file”If you want to save time, vitest-cucumber is able to generate a spec file automatically via the CLI.
You can use it like this:
npx @amiceli/vitest-cucumber --feature <path-to-feature> --spec <path-to-spec> --lang <en:optional>Example:
npx @amiceli/vitest-cucumber --feature features/example.feature --spec src/__tests__/example.spec.tsBy default feature file is parsed with en language.
You can override this with --lang option :
npx @amiceli/vitest-cucumber --feature features/example.feature --spec src/__tests__/example.spec.ts --lang fr