Installation (Cypress)
Install the package
Section titled “Install the package”pnpm add -D executable-stories-cypressOr with npm:
npm install -D executable-stories-cypressRegister the plugin
Section titled “Register the plugin”In cypress.config.ts, register the executable-stories task so story meta can be sent from the browser to Node:
import { defineConfig } from 'cypress';import { registerExecutableStoriesPlugin } from 'executable-stories-cypress/plugin';
export default defineConfig({ e2e: { setupNodeEvents(on) { registerExecutableStoriesPlugin(on); }, },});Add the support file
Section titled “Add the support file”Import the support file so story meta is sent after each test (e.g. in cypress/support/e2e.ts):
import 'executable-stories-cypress/support';This registers an afterEach that sends collected story metadata to Node via cy.task.
Reporter (optional)
Section titled “Reporter (optional)”To generate Markdown or HTML from Cypress runs you can:
- Use the Mocha reporter when Cypress invokes it:
--reporter executable-stories-cypress/reporterwith--reporter-options outputDir=...,outputName=.... - Or use the Module API: after
cypress.run(), callbuildRawRunFromCypressResult(result, options)thengenerateReportsFromRawRun(rawRun, options)(see exports fromexecutable-stories-cypress/reporter).
Options match the formatters’ FormatterOptions (e.g. formats, outputDir, outputName, markdown). See Cypress reporter options for details.
First Story (Cypress) — write your first scenario and see the generated output.
Cypress reporter options — all configuration options.