vitest-cucumber is an opiniated tool (not a plugin) for write unit tests following Gherkin.
It’s inspirated by jest-cucumber, but for vitest.
Gherkin Feature
is writtent in .feature
file. This is an example :
# example.feature
Feature: use vitest-cucumber with vitest
Scenario: Run unit tests
Given I have installed vitest-cucumber
And I have a feature like "example.feature"
When I run vitest-cucumber
Then My feature file is parsed
And I can test my scenarios
Now you can use it with vitest-cucumber :
// example-feature.spec.ts
import { loadFeature, describeFeature } from '@amiceli/vitest-cucumber'
const feature = await loadFeature('./example.feature')
describeFeature(feature, ({ Scenario }) => {
Scenario('Run unit tests', ({ Given, When, Then, And }) => {
Given('I have installed vitest-cucumber', () => {})
And('I have a feature like "example.feature"', () => {})
When('I run vitest-cucumber', () => {})
Then('My feature file is parsed', () => {})
And('I can test my scenarios', () => {})
})
})
Now, if you’re intresting you can install it.