From 94bb02a13a512a086705896ed0afdb1958da6cdb Mon Sep 17 00:00:00 2001 From: "M.P. Korstanje" Date: Mon, 26 Jan 2026 12:44:07 +0100 Subject: [PATCH 1/8] Allow ExpressionsGroup.children to be optional Children were made optional in: - https://github.com/cucumber/cucumber-expressions/pull/387 - https://github.com/cucumber/messages/pull/370 This PR allows the children to be optional in advance of that change. --- src/makeTestPlan.ts | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/makeTestPlan.ts b/src/makeTestPlan.ts index eede45b..388cdf6 100644 --- a/src/makeTestPlan.ts +++ b/src/makeTestPlan.ts @@ -221,6 +221,13 @@ function fromPickleSteps( } function mapArgumentGroup(group: ExpressionsGroup): MessagesGroup { + if (group.children === undefined) { + // @ts-expect-error children are optional for messages 32+ and cucumber expressions 19+ + return { + start: group.start, + value: group.value, + } + } return { start: group.start, value: group.value, From a05f723bb15e37529aded167ef8792c8f5d2465a Mon Sep 17 00:00:00 2001 From: David Goss Date: Tue, 27 Jan 2026 15:38:13 +0000 Subject: [PATCH 2/8] lockfile refresh --- package-lock.json | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/package-lock.json b/package-lock.json index 3504378..1a99148 100644 --- a/package-lock.json +++ b/package-lock.json @@ -91,7 +91,6 @@ "integrity": "sha512-1OSoW+GQvFUNAl6tdP2CTBexTXMNJF0094goVUcvugtQeXtJ0K8sCP0xbq7GGoiezs/eJAAOD03+zAPT64orHQ==", "dev": true, "license": "MIT", - "peer": true, "dependencies": { "class-transformer": "0.5.1", "reflect-metadata": "0.2.2" @@ -684,7 +683,6 @@ "integrity": "sha512-PRA911Blj99jR5RMeTunVbNXMF6Lp4vZXnk5GQjcnUWUTsrXtekg/pnmFFI2u/I36Y/2bITGS30GZCXei6uNkA==", "dev": true, "license": "MIT", - "peer": true, "dependencies": { "fast-deep-equal": "^3.1.3", "json-schema-traverse": "^1.0.0", @@ -1090,7 +1088,6 @@ "integrity": "sha512-kVIaQE9vrN9RLCQMQ3iyRlVJpTiDUY6woHGb30JDkfJErqrQEmtdWH3gV0PBAfGZgQXoqzXOO0T3K6ioApbbAA==", "dev": true, "license": "MIT", - "peer": true, "dependencies": { "@typescript-eslint/scope-manager": "8.37.0", "@typescript-eslint/types": "8.37.0", @@ -1283,7 +1280,6 @@ "integrity": "sha512-NZyJarBfL7nWwIq+FDL6Zp/yHEhePMNnnJ0y3qfieCrmNvYct8uvtiV41UvlSe6apAfk0fY1FbWx+NwfmpvtTg==", "dev": true, "license": "MIT", - "peer": true, "bin": { "acorn": "bin/acorn" }, @@ -1526,7 +1522,6 @@ "integrity": "sha512-NUPRluOfOiTKBKvWPtSD4PhFvWCqOi0BGStNWs57X9js7XGTprSmFoz5F0tWhR4WPjNeR9jXqdC7/UpSJTnlRg==", "dev": true, "license": "MIT", - "peer": true, "engines": { "node": ">=18" } @@ -1822,7 +1817,6 @@ "integrity": "sha512-QldCVh/ztyKJJZLr4jXNUByx3gR+TDYZCRXEktiZoUR3PGy4qCmSbkxcIle8GEwGpb5JBZazlaJ/CxLidXdEbQ==", "dev": true, "license": "MIT", - "peer": true, "dependencies": { "@eslint-community/eslint-utils": "^4.2.0", "@eslint-community/regexpp": "^4.12.1", @@ -3610,7 +3604,6 @@ "integrity": "sha512-p1diW6TqL9L07nNxvRMM7hMMw4c5XOo/1ibL4aAIGmSAt9slTE1Xgw5KWuof2uTOvCg9BY7ZRi+GaF+7sfgPeQ==", "dev": true, "license": "Apache-2.0", - "peer": true, "bin": { "tsc": "bin/tsc", "tsserver": "bin/tsserver" @@ -3655,7 +3648,8 @@ "resolved": "https://registry.npmjs.org/undici-types/-/undici-types-7.8.0.tgz", "integrity": "sha512-9UJ2xGDvQ43tYyVMpuHlsgApydB8ZKfVYTsLDhXkFL/6gfkp+U8xTGdh8pMJv1SpZna0zxG1DwsKZsreLbXBxw==", "dev": true, - "license": "MIT" + "license": "MIT", + "peer": true }, "node_modules/universalify": { "version": "2.0.1", From 324143c6ac5d532210e1e40f760be28dbde901d8 Mon Sep 17 00:00:00 2001 From: David Goss Date: Tue, 27 Jan 2026 15:38:51 +0000 Subject: [PATCH 3/8] remove unnecessary ts-expect-error --- src/makeTestPlan.ts | 1 - 1 file changed, 1 deletion(-) diff --git a/src/makeTestPlan.ts b/src/makeTestPlan.ts index 388cdf6..70f18a3 100644 --- a/src/makeTestPlan.ts +++ b/src/makeTestPlan.ts @@ -222,7 +222,6 @@ function fromPickleSteps( function mapArgumentGroup(group: ExpressionsGroup): MessagesGroup { if (group.children === undefined) { - // @ts-expect-error children are optional for messages 32+ and cucumber expressions 19+ return { start: group.start, value: group.value, From edf4ccb40c4e3dfb5cb1c92e43beadf3bdb5beeb Mon Sep 17 00:00:00 2001 From: David Goss Date: Tue, 27 Jan 2026 15:41:38 +0000 Subject: [PATCH 4/8] bump cucumber-expressions --- package-lock.json | 8 ++++---- package.json | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/package-lock.json b/package-lock.json index 7883b3e..faf7240 100644 --- a/package-lock.json +++ b/package-lock.json @@ -9,7 +9,7 @@ "version": "0.8.2", "license": "MIT", "devDependencies": { - "@cucumber/cucumber-expressions": "^18.0.1", + "@cucumber/cucumber-expressions": "^19.0.0", "@cucumber/gherkin": "^38.0.0", "@cucumber/messages": "^32.0.0", "@cucumber/query": "^15.0.0", @@ -66,9 +66,9 @@ } }, "node_modules/@cucumber/cucumber-expressions": { - "version": "18.0.1", - "resolved": "https://registry.npmjs.org/@cucumber/cucumber-expressions/-/cucumber-expressions-18.0.1.tgz", - "integrity": "sha512-NSid6bI+7UlgMywl5octojY5NXnxR9uq+JisjOrO52VbFsQM6gTWuQFE8syI10KnIBEdPzuEUSVEeZ0VFzRnZA==", + "version": "19.0.0", + "resolved": "https://registry.npmjs.org/@cucumber/cucumber-expressions/-/cucumber-expressions-19.0.0.tgz", + "integrity": "sha512-4FKoOQh2Uf6F6/Ln+1OxuK8LkTg6PyAqekhf2Ix8zqV2M54sH+m7XNJNLhOFOAW/t9nxzRbw2CcvXbCLjcvHZg==", "dev": true, "license": "MIT", "dependencies": { diff --git a/package.json b/package.json index 1e226b9..591b3eb 100644 --- a/package.json +++ b/package.json @@ -37,7 +37,7 @@ "@cucumber/tag-expressions": "*" }, "devDependencies": { - "@cucumber/cucumber-expressions": "^18.0.1", + "@cucumber/cucumber-expressions": "^19.0.0", "@cucumber/gherkin": "^38.0.0", "@cucumber/messages": "^32.0.0", "@cucumber/query": "^15.0.0", From 0a1347a5227945d2e649edc9910b3b4d5b6d3c06 Mon Sep 17 00:00:00 2001 From: David Goss Date: Tue, 27 Jan 2026 15:42:42 +0000 Subject: [PATCH 5/8] update existing test --- src/makeTestPlan.spec.ts | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/makeTestPlan.spec.ts b/src/makeTestPlan.spec.ts index ca396f7..6e531f1 100644 --- a/src/makeTestPlan.spec.ts +++ b/src/makeTestPlan.spec.ts @@ -588,7 +588,6 @@ describe('makeTestPlan', () => { stepMatchArguments: [ { group: { - children: [], start: 10, value: '4', }, @@ -596,7 +595,6 @@ describe('makeTestPlan', () => { }, { group: { - children: [], start: 19, value: '5', }, From 2f35b2a48ff71af9f0b476a79ff886d03f7825be Mon Sep 17 00:00:00 2001 From: David Goss Date: Tue, 27 Jan 2026 15:56:24 +0000 Subject: [PATCH 6/8] expand testing to both paths --- src/makeTestPlan.spec.ts | 59 ++++++++++++++++++++++++++++++------- testdata/parameters.feature | 3 +- 2 files changed, 51 insertions(+), 11 deletions(-) diff --git a/src/makeTestPlan.spec.ts b/src/makeTestPlan.spec.ts index 6e531f1..8ee92db 100644 --- a/src/makeTestPlan.spec.ts +++ b/src/makeTestPlan.spec.ts @@ -555,10 +555,21 @@ describe('makeTestPlan', () => { fn: sinon.stub(), sourceReference: { uri: 'hooks.js', location: { line: 2, column: 1 } }, }) + .parameterType({ + name: 'flight', + regexp: /([A-Z]{3})-([A-Z]{3})/, + transformer: sinon.stub(), + sourceReference: { uri: 'hooks.js', location: { line: 1, column: 1 } }, + }) .step({ pattern: 'we scored {int} out of {int}', fn: sinon.stub(), - sourceReference: { uri: 'steps.js', location: { line: 1, column: 1 } }, + sourceReference: { uri: 'steps.js', location: { line: 2, column: 1 } }, + }) + .step({ + pattern: '{flight} has been delayed', + fn: sinon.stub(), + sourceReference: { uri: 'steps.js', location: { line: 3, column: 1 } }, }) .build() @@ -572,17 +583,17 @@ describe('makeTestPlan', () => { expect(result.toEnvelopes()).to.deep.eq([ { testCase: { - id: '7', - pickleId: '3', + id: '11', + pickleId: '5', testSteps: [ { - hookId: '4', - id: '8', + hookId: '6', + id: '12', }, { - id: '9', - pickleStepId: '2', - stepDefinitionIds: ['6'], + id: '13', + pickleStepId: '3', + stepDefinitionIds: ['9'], stepMatchArgumentsLists: [ { stepMatchArguments: [ @@ -605,8 +616,36 @@ describe('makeTestPlan', () => { ], }, { - hookId: '5', - id: '10', + id: '14', + pickleStepId: '4', + stepDefinitionIds: ['10'], + stepMatchArgumentsLists: [ + { + stepMatchArguments: [ + { + group: { + children: [ + { + start: 0, + value: 'LHR', + }, + { + start: 4, + value: 'CDG', + }, + ], + start: 0, + value: 'LHR-CDG', + }, + parameterTypeName: 'flight', + }, + ], + }, + ], + }, + { + hookId: '7', + id: '15', }, ], testRunStartedId, diff --git a/testdata/parameters.feature b/testdata/parameters.feature index 9289c67..ee3e24d 100644 --- a/testdata/parameters.feature +++ b/testdata/parameters.feature @@ -1,3 +1,4 @@ Feature: a feature Scenario: a scenario - Given we scored 4 out of 5 \ No newline at end of file + Given we scored 4 out of 5 + And LHR-CDG has been delayed \ No newline at end of file From a027b848f68de20be1bd0cde0dfbcc70f6991c31 Mon Sep 17 00:00:00 2001 From: David Goss Date: Tue, 27 Jan 2026 15:57:47 +0000 Subject: [PATCH 7/8] Update CHANGELOG.md --- CHANGELOG.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 8f741e9..eadf74a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,8 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/) and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). ## [Unreleased] +### Changed +- Allow ExpressionsGroup.children to be optional ([#43](https://github.com/cucumber/javascript-core/pull/43)) ## [0.8.2] - 2026-01-12 ### Changed From 29eb53124e45b4280226c2fb1d84d0e9db5f29fd Mon Sep 17 00:00:00 2001 From: David Goss Date: Tue, 27 Jan 2026 16:02:19 +0000 Subject: [PATCH 8/8] check falsy rather than undefined --- src/makeTestPlan.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/makeTestPlan.ts b/src/makeTestPlan.ts index 70f18a3..b8d0125 100644 --- a/src/makeTestPlan.ts +++ b/src/makeTestPlan.ts @@ -221,7 +221,7 @@ function fromPickleSteps( } function mapArgumentGroup(group: ExpressionsGroup): MessagesGroup { - if (group.children === undefined) { + if (!group.children) { return { start: group.start, value: group.value,