executable-stories-jest 2.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/setup.js ADDED
@@ -0,0 +1,311 @@
1
+ // src/setup.ts
2
+ import { afterAll } from "@jest/globals";
3
+
4
+ // src/story-api.ts
5
+ import * as fs from "fs";
6
+ import * as path from "path";
7
+ import { createHash } from "crypto";
8
+ var storyRegistry = globalThis.__jestExecutableStoriesRegistry ??= /* @__PURE__ */ new Map();
9
+ var attachmentRegistry = /* @__PURE__ */ new Map();
10
+ var exitHandlerRegistered = globalThis.__jestExecutableStoriesExitHandler ?? false;
11
+ function getOutputDir() {
12
+ const baseDir = process.env.JEST_STORY_DOCS_DIR ?? ".jest-executable-stories";
13
+ return path.resolve(process.cwd(), baseDir);
14
+ }
15
+ function flushStories() {
16
+ if (storyRegistry.size === 0) return;
17
+ const workerId = process.env.JEST_WORKER_ID ?? "0";
18
+ const outputDir = path.join(getOutputDir(), `worker-${workerId}`);
19
+ fs.mkdirSync(outputDir, { recursive: true });
20
+ for (const [testFilePath, scenarios] of storyRegistry) {
21
+ if (!scenarios.length) continue;
22
+ const hash = createHash("sha1").update(testFilePath).digest("hex").slice(0, 12);
23
+ const baseName = testFilePath === "unknown" ? "unknown" : path.basename(testFilePath);
24
+ const outFile = path.join(outputDir, `${baseName}.${hash}.json`);
25
+ const fileAttachments = attachmentRegistry.get(testFilePath);
26
+ const scenariosWithAttachments = scenarios.map((s) => ({
27
+ ...s,
28
+ _attachments: fileAttachments?.get(s.scenario) ?? []
29
+ }));
30
+ const payload = { testFilePath, scenarios: scenariosWithAttachments };
31
+ fs.writeFileSync(outFile, JSON.stringify(payload, null, 2) + "\n", "utf8");
32
+ }
33
+ storyRegistry.clear();
34
+ attachmentRegistry.clear();
35
+ }
36
+ function registerExitHandler() {
37
+ if (exitHandlerRegistered) return;
38
+ exitHandlerRegistered = true;
39
+ globalThis.__jestExecutableStoriesExitHandler = true;
40
+ process.on("exit", () => {
41
+ flushStories();
42
+ });
43
+ }
44
+ var activeContext = null;
45
+ var sourceOrderCounter = 0;
46
+ function getContext() {
47
+ if (!activeContext) {
48
+ throw new Error(
49
+ "story.init() must be called first. Use: it('name', () => { story.init(); ... });"
50
+ );
51
+ }
52
+ return activeContext;
53
+ }
54
+ function normalizeTickets(ticket) {
55
+ if (!ticket) return void 0;
56
+ return Array.isArray(ticket) ? ticket : [ticket];
57
+ }
58
+ function extractSuitePath(currentTestName) {
59
+ const parts = currentTestName.split(" > ");
60
+ if (parts.length <= 1) {
61
+ return { testName: currentTestName };
62
+ }
63
+ const testName = parts[parts.length - 1];
64
+ const suitePath = parts.slice(0, -1);
65
+ return { suitePath, testName };
66
+ }
67
+ function convertStoryDocsToEntries(docs) {
68
+ const entries = [];
69
+ if (docs.note) {
70
+ entries.push({ kind: "note", text: docs.note, phase: "runtime" });
71
+ }
72
+ if (docs.tag) {
73
+ const names = Array.isArray(docs.tag) ? docs.tag : [docs.tag];
74
+ entries.push({ kind: "tag", names, phase: "runtime" });
75
+ }
76
+ if (docs.kv) {
77
+ for (const [label, value] of Object.entries(docs.kv)) {
78
+ entries.push({ kind: "kv", label, value, phase: "runtime" });
79
+ }
80
+ }
81
+ if (docs.code) {
82
+ entries.push({ kind: "code", label: docs.code.label, content: docs.code.content, lang: docs.code.lang, phase: "runtime" });
83
+ }
84
+ if (docs.json) {
85
+ entries.push({ kind: "code", label: docs.json.label, content: JSON.stringify(docs.json.value, null, 2), lang: "json", phase: "runtime" });
86
+ }
87
+ if (docs.table) {
88
+ entries.push({ kind: "table", label: docs.table.label, columns: docs.table.columns, rows: docs.table.rows, phase: "runtime" });
89
+ }
90
+ if (docs.link) {
91
+ entries.push({ kind: "link", label: docs.link.label, url: docs.link.url, phase: "runtime" });
92
+ }
93
+ if (docs.section) {
94
+ entries.push({ kind: "section", title: docs.section.title, markdown: docs.section.markdown, phase: "runtime" });
95
+ }
96
+ if (docs.mermaid) {
97
+ entries.push({ kind: "mermaid", code: docs.mermaid.code, title: docs.mermaid.title, phase: "runtime" });
98
+ }
99
+ if (docs.screenshot) {
100
+ entries.push({ kind: "screenshot", path: docs.screenshot.path, alt: docs.screenshot.alt, phase: "runtime" });
101
+ }
102
+ if (docs.custom) {
103
+ entries.push({ kind: "custom", type: docs.custom.type, data: docs.custom.data, phase: "runtime" });
104
+ }
105
+ return entries;
106
+ }
107
+ function attachDoc(entry) {
108
+ const ctx = getContext();
109
+ if (ctx.currentStep) {
110
+ ctx.currentStep.docs ??= [];
111
+ ctx.currentStep.docs.push(entry);
112
+ } else {
113
+ ctx.meta.docs ??= [];
114
+ ctx.meta.docs.push(entry);
115
+ }
116
+ }
117
+ function createStepMarker(keyword) {
118
+ return function stepMarker(text, docs) {
119
+ const ctx = getContext();
120
+ const step = {
121
+ id: `step-${ctx.stepCounter++}`,
122
+ keyword,
123
+ text,
124
+ docs: docs ? convertStoryDocsToEntries(docs) : []
125
+ };
126
+ ctx.meta.steps.push(step);
127
+ ctx.currentStep = step;
128
+ };
129
+ }
130
+ function init(options) {
131
+ const state = expect.getState();
132
+ const currentTestName = state.currentTestName || "Unknown test";
133
+ const testPath = state.testPath || "unknown";
134
+ const { suitePath, testName } = extractSuitePath(currentTestName);
135
+ const meta = {
136
+ scenario: testName,
137
+ steps: [],
138
+ suitePath,
139
+ tags: options?.tags,
140
+ tickets: normalizeTickets(options?.ticket),
141
+ meta: options?.meta,
142
+ sourceOrder: sourceOrderCounter++
143
+ };
144
+ const existing = storyRegistry.get(testPath);
145
+ if (existing) {
146
+ existing.push(meta);
147
+ } else {
148
+ storyRegistry.set(testPath, [meta]);
149
+ }
150
+ registerExitHandler();
151
+ activeContext = {
152
+ meta,
153
+ currentStep: null,
154
+ stepCounter: 0,
155
+ attachments: [],
156
+ activeTimers: /* @__PURE__ */ new Map(),
157
+ timerCounter: 0
158
+ };
159
+ if (!attachmentRegistry.has(testPath)) {
160
+ attachmentRegistry.set(testPath, /* @__PURE__ */ new Map());
161
+ }
162
+ attachmentRegistry.get(testPath).set(meta.scenario, activeContext.attachments);
163
+ }
164
+ function fn(keyword, text, body) {
165
+ const ctx = getContext();
166
+ const step = {
167
+ id: `step-${ctx.stepCounter++}`,
168
+ keyword,
169
+ text,
170
+ docs: [],
171
+ wrapped: true
172
+ };
173
+ ctx.meta.steps.push(step);
174
+ ctx.currentStep = step;
175
+ const start = performance.now();
176
+ try {
177
+ const result = body();
178
+ if (result instanceof Promise) {
179
+ return result.then(
180
+ (val) => {
181
+ step.durationMs = performance.now() - start;
182
+ return val;
183
+ },
184
+ (err) => {
185
+ step.durationMs = performance.now() - start;
186
+ throw err;
187
+ }
188
+ );
189
+ }
190
+ step.durationMs = performance.now() - start;
191
+ return result;
192
+ } catch (err) {
193
+ step.durationMs = performance.now() - start;
194
+ throw err;
195
+ }
196
+ }
197
+ function storyExpect(text, body) {
198
+ return fn("Then", text, body);
199
+ }
200
+ var story = {
201
+ // Jest-specific init
202
+ init,
203
+ // BDD step markers
204
+ given: createStepMarker("Given"),
205
+ when: createStepMarker("When"),
206
+ then: createStepMarker("Then"),
207
+ and: createStepMarker("And"),
208
+ but: createStepMarker("But"),
209
+ // AAA pattern aliases
210
+ arrange: createStepMarker("Given"),
211
+ act: createStepMarker("When"),
212
+ assert: createStepMarker("Then"),
213
+ // Additional aliases
214
+ setup: createStepMarker("Given"),
215
+ context: createStepMarker("Given"),
216
+ execute: createStepMarker("When"),
217
+ action: createStepMarker("When"),
218
+ verify: createStepMarker("Then"),
219
+ // Standalone doc methods
220
+ note(text) {
221
+ attachDoc({ kind: "note", text, phase: "runtime" });
222
+ },
223
+ tag(name) {
224
+ const names = Array.isArray(name) ? name : [name];
225
+ attachDoc({ kind: "tag", names, phase: "runtime" });
226
+ },
227
+ kv(options) {
228
+ attachDoc({ kind: "kv", label: options.label, value: options.value, phase: "runtime" });
229
+ },
230
+ json(options) {
231
+ const content = JSON.stringify(options.value, null, 2);
232
+ attachDoc({ kind: "code", label: options.label, content, lang: "json", phase: "runtime" });
233
+ },
234
+ code(options) {
235
+ attachDoc({ kind: "code", label: options.label, content: options.content, lang: options.lang, phase: "runtime" });
236
+ },
237
+ table(options) {
238
+ attachDoc({ kind: "table", label: options.label, columns: options.columns, rows: options.rows, phase: "runtime" });
239
+ },
240
+ link(options) {
241
+ attachDoc({ kind: "link", label: options.label, url: options.url, phase: "runtime" });
242
+ },
243
+ section(options) {
244
+ attachDoc({ kind: "section", title: options.title, markdown: options.markdown, phase: "runtime" });
245
+ },
246
+ mermaid(options) {
247
+ attachDoc({ kind: "mermaid", code: options.code, title: options.title, phase: "runtime" });
248
+ },
249
+ screenshot(options) {
250
+ attachDoc({ kind: "screenshot", path: options.path, alt: options.alt, phase: "runtime" });
251
+ },
252
+ custom(options) {
253
+ attachDoc({ kind: "custom", type: options.type, data: options.data, phase: "runtime" });
254
+ },
255
+ // Attachments
256
+ attach(options) {
257
+ const ctx = getContext();
258
+ const stepIndex = ctx.currentStep ? ctx.meta.steps.indexOf(ctx.currentStep) : void 0;
259
+ ctx.attachments.push({
260
+ ...options,
261
+ stepIndex: stepIndex !== void 0 && stepIndex >= 0 ? stepIndex : void 0,
262
+ stepId: ctx.currentStep?.id
263
+ });
264
+ },
265
+ // Step wrappers
266
+ fn,
267
+ expect: storyExpect,
268
+ // Step timing
269
+ startTimer() {
270
+ const ctx = getContext();
271
+ const token = ctx.timerCounter++;
272
+ const stepIndex = ctx.currentStep ? ctx.meta.steps.indexOf(ctx.currentStep) : void 0;
273
+ ctx.activeTimers.set(token, {
274
+ start: performance.now(),
275
+ stepIndex: stepIndex !== void 0 && stepIndex >= 0 ? stepIndex : void 0,
276
+ stepId: ctx.currentStep?.id,
277
+ consumed: false
278
+ });
279
+ return token;
280
+ },
281
+ endTimer(token) {
282
+ const ctx = getContext();
283
+ const entry = ctx.activeTimers.get(token);
284
+ if (!entry || entry.consumed) return;
285
+ entry.consumed = true;
286
+ const durationMs = performance.now() - entry.start;
287
+ let step;
288
+ if (entry.stepId) {
289
+ step = ctx.meta.steps.find((s) => s.id === entry.stepId);
290
+ }
291
+ if (!step && entry.stepIndex !== void 0) {
292
+ step = ctx.meta.steps[entry.stepIndex];
293
+ }
294
+ if (step) {
295
+ step.durationMs = durationMs;
296
+ }
297
+ }
298
+ };
299
+ var _internal = {
300
+ flushStories,
301
+ /** Clear active context (for tests that assert getContext() throws). */
302
+ clearContext() {
303
+ activeContext = null;
304
+ }
305
+ };
306
+
307
+ // src/setup.ts
308
+ afterAll(() => {
309
+ _internal.flushStories();
310
+ });
311
+ //# sourceMappingURL=setup.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/setup.ts","../src/story-api.ts"],"sourcesContent":["/**\n * Jest setup file for executable-stories.\n *\n * Add this to your Jest config's setupFilesAfterEnv:\n *\n * @example\n * ```js\n * // jest.config.js\n * export default {\n * setupFilesAfterEnv: ['jest-executable-stories/setup'],\n * reporters: [\n * 'default',\n * ['jest-executable-stories/reporter', { outputFile: 'docs/user-stories.md' }]\n * ],\n * };\n * ```\n */\n\nimport { afterAll } from \"@jest/globals\";\nimport { _internal } from \"./story-api\";\n\n// Register afterAll hook to flush stories at the file level\nafterAll(() => {\n _internal.flushStories();\n});\n","/**\n * Jest story.* API for executable-stories.\n *\n * Uses native Jest describe/it/test with opt-in documentation:\n *\n * @example\n * ```ts\n * import { story } from 'executable-stories-jest';\n *\n * describe('Calculator', () => {\n * it('adds two numbers', () => {\n * story.init();\n *\n * story.given('two numbers 5 and 3');\n * const a = 5;\n * const b = 3;\n *\n * story.when('I add them together');\n * const result = a + b;\n *\n * story.then('the result is 8');\n * expect(result).toBe(8);\n * });\n * });\n * ```\n */\n\nimport * as fs from \"node:fs\";\nimport * as path from \"node:path\";\nimport { createHash } from \"node:crypto\";\nimport type {\n DocEntry,\n StepKeyword,\n StoryDocs,\n StoryMeta,\n StoryOptions,\n StoryStep,\n ScopedAttachment,\n AttachmentOptions,\n KvOptions,\n JsonOptions,\n CodeOptions,\n TableOptions,\n LinkOptions,\n SectionOptions,\n MermaidOptions,\n ScreenshotOptions,\n CustomOptions,\n} from './types';\n\n// Re-export types for consumers\nexport type {\n StoryMeta,\n StoryStep,\n DocEntry,\n StepKeyword,\n StoryDocs,\n StoryOptions,\n AttachmentOptions,\n} from './types';\n\n// ============================================================================\n// Story Context\n// ============================================================================\n\n/** Internal timer entry */\ninterface TimerEntry {\n start: number;\n stepIndex?: number;\n stepId?: string;\n consumed: boolean;\n}\n\ninterface StoryContext {\n /** The story metadata being built */\n meta: StoryMeta;\n /** The current step (for attaching docs) */\n currentStep: StoryStep | null;\n /** Deterministic step counter (resets per test case) */\n stepCounter: number;\n /** Collected attachments with step scope */\n attachments: ScopedAttachment[];\n /** Active timers keyed by token */\n activeTimers: Map<number, TimerEntry>;\n /** Monotonic timer token counter */\n timerCounter: number;\n}\n\n// ============================================================================\n// File-based story collection (works across Jest worker processes)\n// ============================================================================\n\n// Use globalThis to ensure the registry is shared across module instances\n// This is needed because Jest may load the setup file and test files as separate module instances\ndeclare global {\n // eslint-disable-next-line no-var\n var __jestExecutableStoriesRegistry: Map<string, StoryMeta[]> | undefined;\n // eslint-disable-next-line no-var\n var __jestExecutableStoriesExitHandler: boolean | undefined;\n}\n\n/** Stories collected during test execution, keyed by test file path */\nconst storyRegistry: Map<string, StoryMeta[]> = globalThis.__jestExecutableStoriesRegistry ??= new Map();\n\n/** Attachments collected per story, keyed by test file path → scenario name → attachments */\nconst attachmentRegistry = new Map<string, Map<string, ScopedAttachment[]>>();\n\n/** Track if we've registered the process exit handler */\nlet exitHandlerRegistered = globalThis.__jestExecutableStoriesExitHandler ?? false;\n\n/** Get the output directory for story JSON files */\nfunction getOutputDir(): string {\n const baseDir = process.env.JEST_STORY_DOCS_DIR ?? \".jest-executable-stories\";\n return path.resolve(process.cwd(), baseDir);\n}\n\n/** Flush all collected stories to JSON files */\nfunction flushStories(): void {\n if (storyRegistry.size === 0) return;\n\n const workerId = process.env.JEST_WORKER_ID ?? \"0\";\n const outputDir = path.join(getOutputDir(), `worker-${workerId}`);\n fs.mkdirSync(outputDir, { recursive: true });\n\n for (const [testFilePath, scenarios] of storyRegistry) {\n if (!scenarios.length) continue;\n const hash = createHash(\"sha1\").update(testFilePath).digest(\"hex\").slice(0, 12);\n const baseName = testFilePath === \"unknown\" ? \"unknown\" : path.basename(testFilePath);\n const outFile = path.join(outputDir, `${baseName}.${hash}.json`);\n\n // Include attachments per scenario\n const fileAttachments = attachmentRegistry.get(testFilePath);\n const scenariosWithAttachments = scenarios.map((s) => ({\n ...s,\n _attachments: fileAttachments?.get(s.scenario) ?? [],\n }));\n\n const payload = { testFilePath, scenarios: scenariosWithAttachments };\n fs.writeFileSync(outFile, JSON.stringify(payload, null, 2) + \"\\n\", \"utf8\");\n }\n storyRegistry.clear();\n attachmentRegistry.clear();\n}\n\n/** Register process exit handler to flush stories (once per worker) */\nfunction registerExitHandler(): void {\n if (exitHandlerRegistered) return;\n exitHandlerRegistered = true;\n globalThis.__jestExecutableStoriesExitHandler = true;\n // Use 'exit' event - always fired when Node.js is about to exit\n // Note: Only sync operations work here, which is fine for fs.writeFileSync\n process.on(\"exit\", () => {\n flushStories();\n });\n}\n\n// ============================================================================\n// Jest-specific context\n// ============================================================================\n\n/** Active story context - set by story.init() */\nlet activeContext: StoryContext | null = null;\n\n/** Counter to track source order of stories (increments on each story.init call) */\nlet sourceOrderCounter = 0;\n\n/**\n * Get the current story context. Throws if story.init() wasn't called.\n */\nfunction getContext(): StoryContext {\n if (!activeContext) {\n throw new Error(\n \"story.init() must be called first. Use: it('name', () => { story.init(); ... });\"\n );\n }\n return activeContext;\n}\n\n// ============================================================================\n// Helper Functions\n// ============================================================================\n\n/**\n * Normalize ticket option to array format.\n */\nfunction normalizeTickets(ticket: string | string[] | undefined): string[] | undefined {\n if (!ticket) return undefined;\n return Array.isArray(ticket) ? ticket : [ticket];\n}\n\n/**\n * Extract the suite path from Jest's currentTestName.\n * Jest's currentTestName is formatted as: \"describe1 > describe2 > test name\"\n */\nfunction extractSuitePath(currentTestName: string): { suitePath?: string[]; testName: string } {\n const parts = currentTestName.split(\" > \");\n if (parts.length <= 1) {\n return { testName: currentTestName };\n }\n const testName = parts[parts.length - 1];\n const suitePath = parts.slice(0, -1);\n return { suitePath, testName };\n}\n\n/**\n * Convert StoryDocs inline options to DocEntry array.\n */\nfunction convertStoryDocsToEntries(docs: StoryDocs): DocEntry[] {\n const entries: DocEntry[] = [];\n\n if (docs.note) {\n entries.push({ kind: \"note\", text: docs.note, phase: \"runtime\" });\n }\n if (docs.tag) {\n const names = Array.isArray(docs.tag) ? docs.tag : [docs.tag];\n entries.push({ kind: \"tag\", names, phase: \"runtime\" });\n }\n if (docs.kv) {\n for (const [label, value] of Object.entries(docs.kv)) {\n entries.push({ kind: \"kv\", label, value, phase: \"runtime\" });\n }\n }\n if (docs.code) {\n entries.push({ kind: \"code\", label: docs.code.label, content: docs.code.content, lang: docs.code.lang, phase: \"runtime\" });\n }\n if (docs.json) {\n entries.push({ kind: \"code\", label: docs.json.label, content: JSON.stringify(docs.json.value, null, 2), lang: \"json\", phase: \"runtime\" });\n }\n if (docs.table) {\n entries.push({ kind: \"table\", label: docs.table.label, columns: docs.table.columns, rows: docs.table.rows, phase: \"runtime\" });\n }\n if (docs.link) {\n entries.push({ kind: \"link\", label: docs.link.label, url: docs.link.url, phase: \"runtime\" });\n }\n if (docs.section) {\n entries.push({ kind: \"section\", title: docs.section.title, markdown: docs.section.markdown, phase: \"runtime\" });\n }\n if (docs.mermaid) {\n entries.push({ kind: \"mermaid\", code: docs.mermaid.code, title: docs.mermaid.title, phase: \"runtime\" });\n }\n if (docs.screenshot) {\n entries.push({ kind: \"screenshot\", path: docs.screenshot.path, alt: docs.screenshot.alt, phase: \"runtime\" });\n }\n if (docs.custom) {\n entries.push({ kind: \"custom\", type: docs.custom.type, data: docs.custom.data, phase: \"runtime\" });\n }\n\n return entries;\n}\n\n// ============================================================================\n// Helper to attach doc entry to current step or story-level\n// ============================================================================\n\nfunction attachDoc(entry: DocEntry): void {\n const ctx = getContext();\n if (ctx.currentStep) {\n ctx.currentStep.docs ??= [];\n ctx.currentStep.docs.push(entry);\n } else {\n ctx.meta.docs ??= [];\n ctx.meta.docs.push(entry);\n }\n}\n\n// ============================================================================\n// Step Markers\n// ============================================================================\n\nfunction createStepMarker(keyword: StepKeyword) {\n return function stepMarker(text: string, docs?: StoryDocs): void {\n const ctx = getContext();\n\n const step: StoryStep = {\n id: `step-${ctx.stepCounter++}`,\n keyword,\n text,\n docs: docs ? convertStoryDocsToEntries(docs) : [],\n };\n\n ctx.meta.steps.push(step);\n ctx.currentStep = step;\n };\n}\n\n// ============================================================================\n// story.init() - Jest-specific\n// ============================================================================\n\n/**\n * Initialize a story for the current test.\n * Must be called at the start of each test that wants documentation.\n *\n * @param options - Optional story configuration (tags, ticket, meta)\n *\n * @example\n * ```ts\n * it('adds two numbers', () => {\n * story.init();\n * // ... rest of test\n * });\n * ```\n */\nfunction init(options?: StoryOptions): void {\n // Get current test info from Jest globals\n const state = expect.getState();\n const currentTestName = state.currentTestName || \"Unknown test\";\n const testPath = state.testPath || \"unknown\";\n\n const { suitePath, testName } = extractSuitePath(currentTestName);\n\n const meta: StoryMeta = {\n scenario: testName,\n steps: [],\n suitePath,\n tags: options?.tags,\n tickets: normalizeTickets(options?.ticket),\n meta: options?.meta,\n sourceOrder: sourceOrderCounter++,\n };\n\n // Store in registry for this file\n const existing = storyRegistry.get(testPath);\n if (existing) {\n existing.push(meta);\n } else {\n storyRegistry.set(testPath, [meta]);\n }\n\n // Register exit handler to flush stories when worker exits\n registerExitHandler();\n\n // Set active context\n activeContext = {\n meta,\n currentStep: null,\n stepCounter: 0,\n attachments: [],\n activeTimers: new Map(),\n timerCounter: 0,\n };\n\n // Link attachments to the registry for this test file + scenario\n if (!attachmentRegistry.has(testPath)) {\n attachmentRegistry.set(testPath, new Map());\n }\n attachmentRegistry.get(testPath)!.set(meta.scenario, activeContext.attachments);\n}\n\n// ============================================================================\n// Step Wrappers: story.fn() and story.expect()\n// ============================================================================\n\n/**\n * Wrap a function body as a step. Records the step with timing and `wrapped: true`.\n * Supports both sync and async functions. Returns whatever the function returns.\n *\n * @param keyword - The BDD keyword (Given, When, Then, And, But)\n * @param text - Step description\n * @param body - The function to execute\n * @returns The return value of body (or a Promise of it if body is async)\n *\n * @example\n * ```ts\n * const data = story.fn('Given', 'setup data', () => ({ a: 5, b: 3 }));\n * const result = await story.fn('When', 'call API', async () => fetch('/api'));\n * ```\n */\nfunction fn<T>(keyword: StepKeyword, text: string, body: () => T): T {\n const ctx = getContext();\n\n const step: StoryStep = {\n id: `step-${ctx.stepCounter++}`,\n keyword,\n text,\n docs: [],\n wrapped: true,\n };\n\n ctx.meta.steps.push(step);\n ctx.currentStep = step;\n\n const start = performance.now();\n\n try {\n const result = body();\n\n // Handle async functions\n if (result instanceof Promise) {\n return result.then(\n (val) => {\n step.durationMs = performance.now() - start;\n return val;\n },\n (err) => {\n step.durationMs = performance.now() - start;\n throw err;\n },\n ) as T;\n }\n\n step.durationMs = performance.now() - start;\n return result;\n } catch (err) {\n step.durationMs = performance.now() - start;\n throw err;\n }\n}\n\n/**\n * Wrap an assertion as a Then step. Shorthand for `story.fn('Then', text, body)`.\n *\n * @param text - Step description\n * @param body - The assertion function to execute\n *\n * @example\n * ```ts\n * story.expect('the result is 8', () => { expect(result).toBe(8); });\n * ```\n */\nfunction storyExpect<T>(text: string, body: () => T): T {\n return fn('Then', text, body);\n}\n\n// ============================================================================\n// Export story object\n// ============================================================================\n\n/**\n * The main story API object for Jest.\n *\n * @example\n * ```ts\n * import { story } from 'executable-stories-jest';\n *\n * describe('Calculator', () => {\n * it('adds two numbers', () => {\n * story.init();\n *\n * story.given('two numbers 5 and 3');\n * const a = 5, b = 3;\n *\n * story.when('I add them together');\n * const result = a + b;\n *\n * story.then('the result is 8');\n * expect(result).toBe(8);\n * });\n * });\n * ```\n */\nexport const story = {\n // Jest-specific init\n init,\n\n // BDD step markers\n given: createStepMarker(\"Given\"),\n when: createStepMarker(\"When\"),\n then: createStepMarker(\"Then\"),\n and: createStepMarker(\"And\"),\n but: createStepMarker(\"But\"),\n\n // AAA pattern aliases\n arrange: createStepMarker(\"Given\"),\n act: createStepMarker(\"When\"),\n assert: createStepMarker(\"Then\"),\n\n // Additional aliases\n setup: createStepMarker(\"Given\"),\n context: createStepMarker(\"Given\"),\n execute: createStepMarker(\"When\"),\n action: createStepMarker(\"When\"),\n verify: createStepMarker(\"Then\"),\n\n // Standalone doc methods\n note(text: string): void {\n attachDoc({ kind: \"note\", text, phase: \"runtime\" });\n },\n\n tag(name: string | string[]): void {\n const names = Array.isArray(name) ? name : [name];\n attachDoc({ kind: \"tag\", names, phase: \"runtime\" });\n },\n\n kv(options: KvOptions): void {\n attachDoc({ kind: \"kv\", label: options.label, value: options.value, phase: \"runtime\" });\n },\n\n json(options: JsonOptions): void {\n const content = JSON.stringify(options.value, null, 2);\n attachDoc({ kind: \"code\", label: options.label, content, lang: \"json\", phase: \"runtime\" });\n },\n\n code(options: CodeOptions): void {\n attachDoc({ kind: \"code\", label: options.label, content: options.content, lang: options.lang, phase: \"runtime\" });\n },\n\n table(options: TableOptions): void {\n attachDoc({ kind: \"table\", label: options.label, columns: options.columns, rows: options.rows, phase: \"runtime\" });\n },\n\n link(options: LinkOptions): void {\n attachDoc({ kind: \"link\", label: options.label, url: options.url, phase: \"runtime\" });\n },\n\n section(options: SectionOptions): void {\n attachDoc({ kind: \"section\", title: options.title, markdown: options.markdown, phase: \"runtime\" });\n },\n\n mermaid(options: MermaidOptions): void {\n attachDoc({ kind: \"mermaid\", code: options.code, title: options.title, phase: \"runtime\" });\n },\n\n screenshot(options: ScreenshotOptions): void {\n attachDoc({ kind: \"screenshot\", path: options.path, alt: options.alt, phase: \"runtime\" });\n },\n\n custom(options: CustomOptions): void {\n attachDoc({ kind: \"custom\", type: options.type, data: options.data, phase: \"runtime\" });\n },\n\n // Attachments\n attach(options: AttachmentOptions): void {\n const ctx = getContext();\n const stepIndex = ctx.currentStep\n ? ctx.meta.steps.indexOf(ctx.currentStep)\n : undefined;\n ctx.attachments.push({\n ...options,\n stepIndex: stepIndex !== undefined && stepIndex >= 0 ? stepIndex : undefined,\n stepId: ctx.currentStep?.id,\n });\n },\n\n // Step wrappers\n fn,\n expect: storyExpect,\n\n // Step timing\n startTimer(): number {\n const ctx = getContext();\n const token = ctx.timerCounter++;\n const stepIndex = ctx.currentStep\n ? ctx.meta.steps.indexOf(ctx.currentStep)\n : undefined;\n ctx.activeTimers.set(token, {\n start: performance.now(),\n stepIndex: stepIndex !== undefined && stepIndex >= 0 ? stepIndex : undefined,\n stepId: ctx.currentStep?.id,\n consumed: false,\n });\n return token;\n },\n\n endTimer(token: number): void {\n const ctx = getContext();\n const entry = ctx.activeTimers.get(token);\n if (!entry || entry.consumed) return;\n\n entry.consumed = true;\n const durationMs = performance.now() - entry.start;\n\n let step: StoryStep | undefined;\n if (entry.stepId) {\n step = ctx.meta.steps.find((s) => s.id === entry.stepId);\n }\n if (!step && entry.stepIndex !== undefined) {\n step = ctx.meta.steps[entry.stepIndex];\n }\n\n if (step) {\n step.durationMs = durationMs;\n }\n },\n};\n\nexport type Story = typeof story;\n\n// ============================================================================\n// Internal exports for setup file\n// ============================================================================\n\n/**\n * Internal API for the setup file and tests. Not for public use.\n * @internal\n */\nexport const _internal = {\n flushStories,\n /** Clear active context (for tests that assert getContext() throws). */\n clearContext(): void {\n activeContext = null;\n },\n};\n"],"mappings":";AAkBA,SAAS,gBAAgB;;;ACSzB,YAAY,QAAQ;AACpB,YAAY,UAAU;AACtB,SAAS,kBAAkB;AAyE3B,IAAM,gBAA0C,WAAW,oCAAoC,oBAAI,IAAI;AAGvG,IAAM,qBAAqB,oBAAI,IAA6C;AAG5E,IAAI,wBAAwB,WAAW,sCAAsC;AAG7E,SAAS,eAAuB;AAC9B,QAAM,UAAU,QAAQ,IAAI,uBAAuB;AACnD,SAAY,aAAQ,QAAQ,IAAI,GAAG,OAAO;AAC5C;AAGA,SAA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AAM;AACb,YAAU,aAAa;AACzB,CAAC;","names":[]}
package/package.json ADDED
@@ -0,0 +1,58 @@
1
+ {
2
+ "name": "executable-stories-jest",
3
+ "version": "2.0.0",
4
+ "description": "BDD-style executable stories for Jest with documentation generation",
5
+ "type": "module",
6
+ "sideEffects": false,
7
+ "main": "./dist/index.cjs",
8
+ "module": "./dist/index.js",
9
+ "types": "./dist/index.d.ts",
10
+ "exports": {
11
+ ".": {
12
+ "types": "./dist/index.d.ts",
13
+ "import": "./dist/index.js",
14
+ "require": "./dist/index.cjs"
15
+ },
16
+ "./reporter": {
17
+ "types": "./dist/reporter.d.ts",
18
+ "import": "./dist/reporter.js",
19
+ "require": "./dist/reporter.cjs"
20
+ },
21
+ "./setup": {
22
+ "types": "./dist/setup.d.ts",
23
+ "import": "./dist/setup.js",
24
+ "require": "./dist/setup.cjs"
25
+ }
26
+ },
27
+ "files": [
28
+ "dist"
29
+ ],
30
+ "scripts": {
31
+ "build": "tsup",
32
+ "type-check": "tsc --noEmit",
33
+ "test": "node --experimental-vm-modules node_modules/jest/bin/jest.js --config jest.config.mjs --passWithNoTests"
34
+ },
35
+ "peerDependencies": {
36
+ "jest": ">=30.2.0"
37
+ },
38
+ "dependencies": {
39
+ "executable-stories-formatters": "workspace:*",
40
+ "fast-glob": "^3.3.3"
41
+ },
42
+ "devDependencies": {
43
+ "@jest/globals": "^30.2.0",
44
+ "@types/jest": "^30.0.0",
45
+ "@types/node": "^25.2.1",
46
+ "jest": "^30.2.0",
47
+ "ts-jest": "^29.4.6",
48
+ "tsup": "^8.5.1",
49
+ "typescript": "~5.9.3"
50
+ },
51
+ "keywords": [
52
+ "jest",
53
+ "bdd",
54
+ "testing",
55
+ "documentation",
56
+ "executable-stories"
57
+ ]
58
+ }