Spoken language
Since v3.7.0 vitest-cucumber allows to load feature files with different languages.
You can see available keywords and languages in the cucumber/gherkin project.
Load feature file
When you call loadFeature
you can choose a language:
await loadFeature(`../../lang.feature`, { language: 'fr' })
The default language
is english (en
).
It will also defaults to this language if you set a language that does not exist.
Feature file example
An french feature file example:
Fonctionnalité: utiliser vitest-cucumber en français Scénario: Détecter si la langue existe Etant donné que je choisis "fr" comme language Quand Je lance les tests unitaires Alors vitest-cucumber lit mon scénario
If you mix languages, vitest-cucumber will throw en error, see:
Fonctionnalité: utiliser vitest-cucumber en français Scénario: Détecter si la langue existe Given je choisis "fr" comme language Quand Je lance les tests unitaires Alors vitest-cucumber lit mon scénario
Run unit tests
describeFeature
and other methods to run unit tests are the same.
You still have to use functions like Given
, Background
, Scenario
, etc.