executable-stories-formatters 0.6.2 → 0.7.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "executable-stories-formatters",
3
- "version": "0.6.2",
3
+ "version": "0.7.0",
4
4
  "description": "Cucumber-compatible report formats (HTML, Markdown, JUnit XML, Cucumber JSON) for executable-stories test results.",
5
5
  "author": "Jag Reehal <jag@jagreehal.com>",
6
6
  "license": "MIT",
@@ -57,16 +57,16 @@
57
57
  ],
58
58
  "dependencies": {
59
59
  "@cucumber/html-formatter": "^23.0.0",
60
- "@cucumber/messages": "^32.0.1",
60
+ "@cucumber/messages": "^32.2.0",
61
61
  "ajv": "^8.18.0"
62
62
  },
63
63
  "devDependencies": {
64
64
  "@faker-js/faker": "^10.3.0",
65
- "@types/node": "^25.3.2",
65
+ "@types/node": "^25.5.0",
66
66
  "tsup": "^8.5.1",
67
67
  "tsx": "^4.21.0",
68
68
  "typescript": "~5.9.3",
69
- "vitest": "^4.0.18",
69
+ "vitest": "^4.1.0",
70
70
  "vitest-mock-extended": "^3.1.0"
71
71
  },
72
72
  "scripts": {
@@ -208,6 +208,19 @@
208
208
  "type": "array",
209
209
  "items": { "$ref": "#/$defs/DocEntry" },
210
210
  "description": "Rich documentation entries attached to this step."
211
+ },
212
+ "id": {
213
+ "type": "string",
214
+ "description": "Unique step identifier within the scenario (e.g., 'step-0')."
215
+ },
216
+ "wrapped": {
217
+ "type": "boolean",
218
+ "description": "Whether this step wraps a function call (Fn/Expect pattern)."
219
+ },
220
+ "durationMs": {
221
+ "type": "number",
222
+ "minimum": 0,
223
+ "description": "Step-level duration in milliseconds (from startTimer/endTimer)."
211
224
  }
212
225
  },
213
226
  "required": ["keyword", "text"],
@@ -36,6 +36,12 @@ executable-stories format raw-run.json --format html,markdown,junit
36
36
  # Read from stdin
37
37
  cat raw-run.json | executable-stories format --stdin --format markdown
38
38
 
39
+ # Compare two canonical runs for review-friendly output
40
+ executable-stories compare baseline.json current.json \
41
+ --input-type canonical \
42
+ --format html,markdown \
43
+ --output-name review-diff
44
+
39
45
  # Validate JSON against schema
40
46
  executable-stories validate raw-run.json
41
47
  ```
@@ -55,6 +61,8 @@ const generator = new ReportGenerator({
55
61
  formats: ["markdown", "html"],
56
62
  outputDir: "docs",
57
63
  outputName: "user-stories",
64
+ outputNameTimestamp: true, // optional: unique filenames per run (e.g. user-stories-1739123456.md)
65
+ sortTestCases: "id", // optional: stable order for diff-friendly reports
58
66
  });
59
67
 
60
68
  const outputs = await generator.generate(canonical);
@@ -99,6 +107,8 @@ const cucumberJson = new CucumberJsonFormatter().formatToString(canonical);
99
107
  --format html,markdown,junit,cucumber-json,cucumber-html,cucumber-messages
100
108
  --output-dir reports # Base directory (default: reports)
101
109
  --output-name test-results # Base filename (default: test-results)
110
+ --output-name-timestamp # Append run timestamp (UTC seconds) to filename for before/after diffs
111
+ --sort-test-cases id|source|none # Deterministic scenario order (default: none). Use id for diff-friendly output
102
112
  --input-type raw # raw | canonical | ndjson
103
113
 
104
114
  # Filtering
@@ -138,6 +148,35 @@ const result = validateCanonicalRun(canonical);
138
148
  assertValidRun(canonical);
139
149
  ```
140
150
 
151
+ ### Before/after diffs (evolution of tests)
152
+
153
+ To compare reports across runs (e.g. in CI or locally), use timestamped filenames and deterministic ordering so diffs show real changes instead of random reordering from parallel test execution:
154
+
155
+ ```bash
156
+ executable-stories format raw-run.json --format markdown,html \
157
+ --output-name-timestamp \
158
+ --sort-test-cases id
159
+ ```
160
+
161
+ - `--output-name-timestamp`: appends run start time in UTC seconds (e.g. `test-results-1739123456.md`), so each run produces a unique, chronologically sortable file.
162
+ - `--sort-test-cases id`: sorts scenarios by deterministic id (hash of source file + scenario name) so report content order is stable across runs.
163
+
164
+ Programmatic: set `outputNameTimestamp: true` and `sortTestCases: "id"` (or `"source"` for file/line order) on `FormatterOptions`.
165
+
166
+ For first-class run comparisons, use the dedicated compare subcommand:
167
+
168
+ ```bash
169
+ executable-stories compare baseline.json current.json \
170
+ --input-type canonical \
171
+ --format html,markdown \
172
+ --output-dir reports \
173
+ --output-name test-results-diff
174
+ ```
175
+
176
+ - Generates a standalone HTML review report with filter chips for `Regressed`, `Fixed`, `Added`, `Removed`, and `Changed`.
177
+ - Generates Markdown with per-scenario before/after summaries for PR discussion or artifact storage.
178
+ - Use canonical input when you already persist prior runs; raw and ndjson inputs are also supported as long as both files use the same `--input-type`.
179
+
141
180
  ### Notifications
142
181
 
143
182
  ```bash