Presentation
About vitest-cucumber
Section titled “About vitest-cucumber”vitest-cucumber is an opiniated tool to write acceptance tests following the Gherkin syntax, designed to be used specifically with Vitest.
This package was originally inspirated by jest-cucumber.
Example
Section titled “Example”A Gherkin Feature
is written in a .feature
file. Example:
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
You can then use it with vitest-cucumber:
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', () => {}) })})
Playground
Section titled “Playground”Do not take the word for it, try it out yourself in the following playground.
Next steps
Section titled “Next steps”If you are interested, you can install it here.