executable-stories-jest 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-jest",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "8.0.0",
|
|
4
4
|
"description": "BDD-style executable stories for Jest with documentation generation",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"sideEffects": false,
|
|
@@ -30,22 +30,22 @@
|
|
|
30
30
|
"bin"
|
|
31
31
|
],
|
|
32
32
|
"peerDependencies": {
|
|
33
|
-
"jest": ">=30.
|
|
34
|
-
"executable-stories-formatters": "^0.
|
|
33
|
+
"jest": ">=30.3.0",
|
|
34
|
+
"executable-stories-formatters": "^0.7.0"
|
|
35
35
|
},
|
|
36
36
|
"dependencies": {
|
|
37
37
|
"fast-glob": "^3.3.3"
|
|
38
38
|
},
|
|
39
39
|
"devDependencies": {
|
|
40
|
-
"@jest/globals": "^30.
|
|
40
|
+
"@jest/globals": "^30.3.0",
|
|
41
41
|
"@opentelemetry/api": "^1.9.0",
|
|
42
42
|
"@types/jest": "^30.0.0",
|
|
43
|
-
"@types/node": "^25.
|
|
43
|
+
"@types/node": "^25.5.0",
|
|
44
44
|
"jest": "^30.2.0",
|
|
45
45
|
"ts-jest": "^29.4.6",
|
|
46
46
|
"tsup": "^8.5.1",
|
|
47
47
|
"typescript": "~5.9.3",
|
|
48
|
-
"executable-stories-formatters": "0.
|
|
48
|
+
"executable-stories-formatters": "0.7.0"
|
|
49
49
|
},
|
|
50
50
|
"repository": {
|
|
51
51
|
"type": "git",
|
|
@@ -197,3 +197,29 @@ it("my test", () => {
|
|
|
197
197
|
Steps called before `init()` are silently dropped because no story context exists.
|
|
198
198
|
|
|
199
199
|
Source: packages/eslint-plugin-executable-stories-jest/src/rules/require-story-context-for-steps.ts
|
|
200
|
+
|
|
201
|
+
## Parameterized Scenarios (Scenario Outline equivalent)
|
|
202
|
+
|
|
203
|
+
Use Jest's `it.each` with `story()` to produce one scenario per data row — the framework-native replacement for Cucumber's Scenario Outline + Examples.
|
|
204
|
+
|
|
205
|
+
```ts
|
|
206
|
+
import { story, given, when, then } from "executable-stories-jest";
|
|
207
|
+
|
|
208
|
+
const cases = [
|
|
209
|
+
{ input: 1, expected: 2 },
|
|
210
|
+
{ input: 2, expected: 4 },
|
|
211
|
+
{ input: 3, expected: 6 },
|
|
212
|
+
];
|
|
213
|
+
|
|
214
|
+
describe("Doubling", () => {
|
|
215
|
+
it.each(cases)("doubles $input to $expected", ({ input, expected }) => {
|
|
216
|
+
story(`Doubles ${input} to ${expected}`);
|
|
217
|
+
given(`the input is ${input}`);
|
|
218
|
+
when("the doubler runs");
|
|
219
|
+
then(`the result is ${expected}`);
|
|
220
|
+
expect(input * 2).toBe(expected);
|
|
221
|
+
});
|
|
222
|
+
});
|
|
223
|
+
```
|
|
224
|
+
|
|
225
|
+
Each iteration produces a separate scenario in the generated report. Use interpolated titles so each scenario has a distinct, descriptive name.
|