Installation (Vitest)
Install the packages
Section titled “Install the packages”pnpm add -D vitest executable-stories-vitest executable-stories-formattersOr with npm:
npm install -D vitest executable-stories-vitest executable-stories-formattersAdd the reporter
Section titled “Add the reporter”In vitest.config.ts, import the reporter from the /reporter subpath so the config does not load the main package (which imports Vitest and can cause “Vitest failed to access its internal state” when loaded inside the config file):
import { StoryReporter } from 'executable-stories-vitest/reporter';import { defineConfig } from 'vitest/config';
export default defineConfig({ test: { reporters: ['default', new StoryReporter()], },});Default output
Section titled “Default output”With no options, the reporter uses the formatters package defaults (e.g. Cucumber JSON in reports/). To write Markdown to docs/user-stories.md, pass options to StoryReporter (see Vitest reporter options — e.g. formats: ['markdown'], outputDir: 'docs', outputName: 'user-stories'). Run your tests:
pnpm vitest runThe Markdown file is generated after the test run.
First Story (Vitest) — write your first scenario and see the generated output.
Vitest reporter options — all configuration options.