executable-stories-vitest 7.0.2 → 8.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/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "executable-stories-vitest",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "8.0.0",
|
|
4
4
|
"description": "TS-first story/given/when/then helpers for Vitest with Markdown user-story doc generation.",
|
|
5
5
|
"author": "Jag Reehal <jag@jagreehal.com>",
|
|
6
6
|
"homepage": "https://github.com/jagreehal/executable-stories#readme",
|
|
@@ -37,18 +37,18 @@
|
|
|
37
37
|
"bin"
|
|
38
38
|
],
|
|
39
39
|
"peerDependencies": {
|
|
40
|
-
"vitest": ">=4.0
|
|
41
|
-
"executable-stories-formatters": "^0.
|
|
40
|
+
"vitest": ">=4.1.0",
|
|
41
|
+
"executable-stories-formatters": "^0.7.0"
|
|
42
42
|
},
|
|
43
43
|
"devDependencies": {
|
|
44
44
|
"@opentelemetry/api": "^1.9.0",
|
|
45
|
-
"@types/node": "^25.
|
|
45
|
+
"@types/node": "^25.5.0",
|
|
46
46
|
"@types/picomatch": "^4.0.2",
|
|
47
47
|
"tsup": "^8.5.1",
|
|
48
48
|
"typescript": "^5.9.3",
|
|
49
49
|
"vitest": "^4.0.18",
|
|
50
50
|
"eslint-config-executable-stories": "0.2.0",
|
|
51
|
-
"executable-stories-formatters": "0.
|
|
51
|
+
"executable-stories-formatters": "0.7.0"
|
|
52
52
|
},
|
|
53
53
|
"keywords": [
|
|
54
54
|
"vitest",
|
|
@@ -214,3 +214,30 @@ Source: packages/eslint-plugin-executable-stories-vitest/src/rules/require-init-
|
|
|
214
214
|
|
|
215
215
|
See also: vitest-reporter-setup/SKILL.md — Stories need a reporter to produce output
|
|
216
216
|
See also: eslint-vitest-rules/SKILL.md — ESLint enforces correct story.init() usage
|
|
217
|
+
|
|
218
|
+
## Parameterized Scenarios (Scenario Outline equivalent)
|
|
219
|
+
|
|
220
|
+
Use Vitest's `it.each` with `story()` to produce one scenario per data row — the framework-native replacement for Cucumber's Scenario Outline + Examples.
|
|
221
|
+
|
|
222
|
+
```ts
|
|
223
|
+
import { story } from "executable-stories-vitest";
|
|
224
|
+
|
|
225
|
+
const cases = [
|
|
226
|
+
{ input: 1, expected: 2 },
|
|
227
|
+
{ input: 2, expected: 4 },
|
|
228
|
+
{ input: 3, expected: 6 },
|
|
229
|
+
];
|
|
230
|
+
|
|
231
|
+
describe("Doubling", () => {
|
|
232
|
+
it.each(cases)("doubles $input to $expected", ({ input, expected }) => {
|
|
233
|
+
story(`Doubles ${input} to ${expected}`, (s) => {
|
|
234
|
+
s.given(`the input is ${input}`);
|
|
235
|
+
s.when("the doubler runs");
|
|
236
|
+
s.then(`the result is ${expected}`);
|
|
237
|
+
expect(input * 2).toBe(expected);
|
|
238
|
+
});
|
|
239
|
+
});
|
|
240
|
+
});
|
|
241
|
+
```
|
|
242
|
+
|
|
243
|
+
Each iteration produces a separate scenario in the generated report. Use interpolated titles so each scenario has a distinct, descriptive name.
|