1.1
The contract reads like the domain
Plain Gherkin translated in memory by Vite: Given/When/Then in language the people who own the rules can read — and sign, with no generated test file to drift.
Gherkin, run by Vitest·TypeScript & ReScript·MIT
A BDD runner for Vitest. Every .feature file is also a test suite: plain Given/When/Then bound to typed steps, so what business signed is exactly what the tests measure — in watch mode and in CI.
Renamed: vitest-bdd is now @epure/vitest.
compas /kɔ̃·pa/ n., m. — the divider. Steps the drawing off against the work.
Feature: Calculator
Scenario: Add two numbers
Given I have a "basic" calculator
When I add 1 and 2
Then the result is 3
Scenario: Float calculator
Given I have a "float" calculator
When I divide 1 by 2
Then the result is 0.5
Given("I have a {string} calculator", (name) => {
const calculator = makeCalculator(name)
When("I add {number} and {number}", calculator.add)
Then("the result is {number}", (n: number) => {
expect(calculator.result.value).toBe(n)
})
})
$ npm install -D @epure/vitestA spec nobody executes is an opinion. @epure/vitest makes every feature file a Vitest suite — what business signed is exactly what the tests measure.
1.1
Plain Gherkin translated in memory by Vite: Given/When/Then in language the people who own the rules can read — and sign, with no generated test file to drift.
1.2
Each run steps the drawing off against the work. When reality drifts, the failure points at the exact clause: expected 3, measured 1002.
1.3
Given builds the context; When and Then close over it in plain TypeScript or ReScript — no shared world, so scenarios run concurrently under Vitest.