Skip to content

Installation (Jest)

Terminal window
pnpm add -D jest executable-stories-jest executable-stories-formatters

Or with npm:

Terminal window
npm install -D jest executable-stories-jest executable-stories-formatters

In jest.config.js (or jest.config.mjs), add the Story reporter and setup:

export default {
// ... your existing config
setupFilesAfterEnv: ['executable-stories-jest/setup'],
reporters: [
'default',
[
'executable-stories-jest/reporter',
{
formats: ['markdown'],
outputDir: 'docs',
outputName: 'user-stories',
output: { mode: 'aggregated' },
},
],
],
};

With the option above, the reporter writes to docs/user-stories.md. Run your tests:

Terminal window
pnpm jest

The Markdown file is generated after the test run.

First Story (Jest) — write your first scenario.

Jest reporter options — all configuration options.