@g_package/jest-cucumber-fusion 3.0.1 → 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 +8 -3
- package/package.json +2 -2
- package/src/code-suggestion.js +12 -3
package/dist/index.cjs
CHANGED
|
@@ -9575,13 +9575,18 @@ var starterCodeForShape = (steps) => {
|
|
|
9575
9575
|
};
|
|
9576
9576
|
var stepsByShape = (unboundSteps) => {
|
|
9577
9577
|
const groups = /* @__PURE__ */ new Map();
|
|
9578
|
-
const named = /* @__PURE__ */ new
|
|
9578
|
+
const named = /* @__PURE__ */ new Map();
|
|
9579
9579
|
unboundSteps.forEach((step) => {
|
|
9580
9580
|
const identity = `${step.keyword}\0${step.stepText}`;
|
|
9581
|
-
if (named.has(identity)) return;
|
|
9582
|
-
named.add(identity);
|
|
9583
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
|
+
}
|
|
9584
9588
|
if (!groups.has(shape)) groups.set(shape, []);
|
|
9589
|
+
named.set(identity, groups.get(shape).length);
|
|
9585
9590
|
groups.get(shape).push(step);
|
|
9586
9591
|
});
|
|
9587
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.
|
|
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,7 +47,7 @@
|
|
|
47
47
|
"devDependencies": {
|
|
48
48
|
"@commitlint/cli": "^21.2.3",
|
|
49
49
|
"@commitlint/config-conventional": "^21.2.3",
|
|
50
|
-
"@eslint/js": "^
|
|
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",
|
package/src/code-suggestion.js
CHANGED
|
@@ -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
|
|
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()];
|