@g_package/jest-cucumber-fusion 3.0.0 → 3.0.2

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/index.cjs CHANGED
@@ -9324,14 +9324,21 @@ var parseFeature = (featureText) => {
9324
9324
  try {
9325
9325
  return { document: parser.parse(featureText), ids };
9326
9326
  } catch (parseFailure) {
9327
- throw new Error(`Error parsing feature Gherkin: ${parseFailure.message}`);
9327
+ throw new Error(`Error parsing feature Gherkin: ${parseFailure.message}`, {
9328
+ cause: parseFailure
9329
+ });
9328
9330
  }
9329
9331
  };
9330
9332
  var compilePickles = (document, absoluteFeatureFilePath, ids) => {
9331
9333
  try {
9332
9334
  return compile(document, absoluteFeatureFilePath, ids);
9333
9335
  } catch (compileFailure) {
9334
- throw new Error(`Error parsing feature Gherkin: ${compileFailure.message}`);
9336
+ throw new Error(
9337
+ `Error parsing feature Gherkin: ${compileFailure.message}`,
9338
+ {
9339
+ cause: compileFailure
9340
+ }
9341
+ );
9335
9342
  }
9336
9343
  };
9337
9344
  var eachChild = (children, visit) => {
@@ -9568,13 +9575,18 @@ var starterCodeForShape = (steps) => {
9568
9575
  };
9569
9576
  var stepsByShape = (unboundSteps) => {
9570
9577
  const groups = /* @__PURE__ */ new Map();
9571
- const named = /* @__PURE__ */ new Set();
9578
+ const named = /* @__PURE__ */ new Map();
9572
9579
  unboundSteps.forEach((step) => {
9573
9580
  const identity = `${step.keyword}\0${step.stepText}`;
9574
- if (named.has(identity)) return;
9575
- named.add(identity);
9576
9581
  const shape = shapeOf(step);
9582
+ if (named.has(identity)) {
9583
+ const position = named.get(identity);
9584
+ const group = groups.get(shape);
9585
+ if (group[position].stepArgument == null) group[position] = step;
9586
+ return;
9587
+ }
9577
9588
  if (!groups.has(shape)) groups.set(shape, []);
9589
+ named.set(identity, groups.get(shape).length);
9578
9590
  groups.get(shape).push(step);
9579
9591
  });
9580
9592
  return [...groups.values()];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@g_package/jest-cucumber-fusion",
3
- "version": "3.0.0",
3
+ "version": "3.0.2",
4
4
  "description": "Write cucumber test as part of a jest run (including coverage)",
5
5
  "type": "module",
6
6
  "main": "dist/index.cjs",
@@ -47,18 +47,18 @@
47
47
  "devDependencies": {
48
48
  "@commitlint/cli": "^21.2.3",
49
49
  "@commitlint/config-conventional": "^21.2.3",
50
- "@eslint/js": "^9.39.5",
50
+ "@eslint/js": "^10.0.1",
51
51
  "@secretlint/secretlint-rule-pattern": "^13.0.7",
52
52
  "@secretlint/secretlint-rule-preset-recommend": "^13.0.7",
53
53
  "cz-conventional-changelog": "^3.3.0",
54
54
  "esbuild": "0.28.2",
55
- "eslint": "^9.39.5",
55
+ "eslint": "^10.12.0",
56
56
  "eslint-plugin-jest": "^29.16.6",
57
57
  "fast-check": "^4.10.2",
58
58
  "globals": "^17.13.0",
59
59
  "husky": "^9.1.7",
60
60
  "jest": "^30.4.2",
61
- "lint-staged": "^16.4.0",
61
+ "lint-staged": "^17.6.0",
62
62
  "prettier": "3.9.9",
63
63
  "secretlint": "^13.0.7",
64
64
  "semantic-release": "^25.0.5",
@@ -177,15 +177,24 @@ const starterCodeForShape = (steps) => {
177
177
  // are equal, and as ambiguous when one is wider ("(\d+)" beside a decimal capture both match
178
178
  // "1"). A step with a table and the same step without one share a shape too; parameters do not
179
179
  // make two definitions distinct.
180
+ //
181
+ // A step named once still counts every time it appears: when only a later appearance carries
182
+ // a Gherkin argument, that appearance stands in for the step, so the starter code has the
183
+ // parameter the step will receive. The text is the same, so the entry reads the same.
180
184
  const stepsByShape = (unboundSteps) => {
181
185
  const groups = new Map();
182
- const named = new Set();
186
+ const named = new Map();
183
187
  unboundSteps.forEach((step) => {
184
188
  const identity = `${step.keyword}\u0000${step.stepText}`;
185
- if (named.has(identity)) return;
186
- named.add(identity);
187
189
  const shape = shapeOf(step);
190
+ if (named.has(identity)) {
191
+ const position = named.get(identity);
192
+ const group = groups.get(shape);
193
+ if (group[position].stepArgument == null) group[position] = step;
194
+ return;
195
+ }
188
196
  if (!groups.has(shape)) groups.set(shape, []);
197
+ named.set(identity, groups.get(shape).length);
189
198
  groups.get(shape).push(step);
190
199
  });
191
200
  return [...groups.values()];
@@ -95,7 +95,9 @@ const parseFeature = (featureText) => {
95
95
  try {
96
96
  return { document: parser.parse(featureText), ids };
97
97
  } catch (parseFailure) {
98
- throw new Error(`Error parsing feature Gherkin: ${parseFailure.message}`);
98
+ throw new Error(`Error parsing feature Gherkin: ${parseFailure.message}`, {
99
+ cause: parseFailure,
100
+ });
99
101
  }
100
102
  };
101
103
 
@@ -103,7 +105,12 @@ const compilePickles = (document, absoluteFeatureFilePath, ids) => {
103
105
  try {
104
106
  return gherkin.compile(document, absoluteFeatureFilePath, ids);
105
107
  } catch (compileFailure) {
106
- throw new Error(`Error parsing feature Gherkin: ${compileFailure.message}`);
108
+ throw new Error(
109
+ `Error parsing feature Gherkin: ${compileFailure.message}`,
110
+ {
111
+ cause: compileFailure,
112
+ },
113
+ );
107
114
  }
108
115
  };
109
116