Skip to content

Commit 7b4bd40

Browse files
authored
Add testRunStartedId (#3)
1 parent 55ebba3 commit 7b4bd40

File tree

5 files changed

+27
-72
lines changed

5 files changed

+27
-72
lines changed

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/)
66
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
77

88
## [Unreleased]
9+
### Added
10+
- BREAKING CHANGE: Add `testRunStartedId` to `TestPlanIngredients` ([#3](https://github.com/cucumber/javascript-core/pull/3))
911

1012
## [0.1.0] - 2025-07-24
1113
### Added

cucumber-core.api.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -170,6 +170,7 @@ export interface TestPlanIngredients {
170170
gherkinDocument: GherkinDocument;
171171
pickles: ReadonlyArray<Pickle>;
172172
supportCodeLibrary: SupportCodeLibrary;
173+
testRunStartedId: string;
173174
}
174175

175176
// @public

src/makeTestPlan.spec.ts

Lines changed: 18 additions & 71 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ function parseGherkin(
3737

3838
describe('makeTestPlan', () => {
3939
class FakeWorld {}
40-
40+
const testRunStartedId = 'run-id'
4141
let newId: () => string
4242

4343
beforeEach(() => {
@@ -51,6 +51,7 @@ describe('makeTestPlan', () => {
5151

5252
const result = makeTestPlan(
5353
{
54+
testRunStartedId,
5455
gherkinDocument,
5556
pickles,
5657
supportCodeLibrary,
@@ -69,6 +70,7 @@ describe('makeTestPlan', () => {
6970

7071
const result = makeTestPlan(
7172
{
73+
testRunStartedId,
7274
gherkinDocument,
7375
pickles,
7476
supportCodeLibrary,
@@ -86,11 +88,7 @@ describe('makeTestPlan', () => {
8688
const supportCodeLibrary = buildSupportCode({ newId }).build()
8789

8890
const result = makeTestPlan(
89-
{
90-
gherkinDocument,
91-
pickles,
92-
supportCodeLibrary,
93-
},
91+
{ testRunStartedId, gherkinDocument, pickles, supportCodeLibrary },
9492
{
9593
newId,
9694
}
@@ -111,11 +109,7 @@ describe('makeTestPlan', () => {
111109
const supportCodeLibrary = buildSupportCode({ newId }).build()
112110

113111
const result = makeTestPlan(
114-
{
115-
gherkinDocument,
116-
pickles,
117-
supportCodeLibrary,
118-
},
112+
{ testRunStartedId, gherkinDocument, pickles, supportCodeLibrary },
119113
{
120114
newId,
121115
strategy: {
@@ -154,11 +148,7 @@ describe('makeTestPlan', () => {
154148
.build()
155149

156150
const result = makeTestPlan(
157-
{
158-
gherkinDocument,
159-
pickles,
160-
supportCodeLibrary,
161-
},
151+
{ testRunStartedId, gherkinDocument, pickles, supportCodeLibrary },
162152
{
163153
newId,
164154
}
@@ -172,11 +162,7 @@ describe('makeTestPlan', () => {
172162
const supportCodeLibrary = buildSupportCode({ newId }).build()
173163

174164
const result = makeTestPlan(
175-
{
176-
gherkinDocument,
177-
pickles,
178-
supportCodeLibrary,
179-
},
165+
{ testRunStartedId, gherkinDocument, pickles, supportCodeLibrary },
180166
{
181167
newId,
182168
}
@@ -201,11 +187,7 @@ describe('makeTestPlan', () => {
201187
.build()
202188

203189
const result = makeTestPlan(
204-
{
205-
gherkinDocument,
206-
pickles,
207-
supportCodeLibrary,
208-
},
190+
{ testRunStartedId, gherkinDocument, pickles, supportCodeLibrary },
209191
{
210192
newId,
211193
}
@@ -235,11 +217,7 @@ describe('makeTestPlan', () => {
235217
.build()
236218

237219
const result = makeTestPlan(
238-
{
239-
gherkinDocument,
240-
pickles,
241-
supportCodeLibrary,
242-
},
220+
{ testRunStartedId, gherkinDocument, pickles, supportCodeLibrary },
243221
{
244222
newId,
245223
}
@@ -269,11 +247,7 @@ describe('makeTestPlan', () => {
269247
.build()
270248

271249
const result = makeTestPlan(
272-
{
273-
gherkinDocument,
274-
pickles,
275-
supportCodeLibrary,
276-
},
250+
{ testRunStartedId, gherkinDocument, pickles, supportCodeLibrary },
277251
{
278252
newId,
279253
}
@@ -308,11 +282,7 @@ describe('makeTestPlan', () => {
308282
.build()
309283

310284
const result = makeTestPlan(
311-
{
312-
gherkinDocument,
313-
pickles,
314-
supportCodeLibrary,
315-
},
285+
{ testRunStartedId, gherkinDocument, pickles, supportCodeLibrary },
316286
{
317287
newId,
318288
}
@@ -359,11 +329,7 @@ describe('makeTestPlan', () => {
359329
.build()
360330

361331
const result = makeTestPlan(
362-
{
363-
gherkinDocument,
364-
pickles,
365-
supportCodeLibrary,
366-
},
332+
{ testRunStartedId, gherkinDocument, pickles, supportCodeLibrary },
367333
{
368334
newId,
369335
}
@@ -414,11 +380,7 @@ describe('makeTestPlan', () => {
414380
.build()
415381

416382
const result = makeTestPlan(
417-
{
418-
gherkinDocument,
419-
pickles,
420-
supportCodeLibrary,
421-
},
383+
{ testRunStartedId, gherkinDocument, pickles, supportCodeLibrary },
422384
{
423385
newId,
424386
}
@@ -484,11 +446,7 @@ describe('makeTestPlan', () => {
484446
.build()
485447

486448
const result = makeTestPlan(
487-
{
488-
gherkinDocument,
489-
pickles,
490-
supportCodeLibrary,
491-
},
449+
{ testRunStartedId, gherkinDocument, pickles, supportCodeLibrary },
492450
{
493451
newId,
494452
}
@@ -528,11 +486,7 @@ describe('makeTestPlan', () => {
528486
.build()
529487

530488
const result = makeTestPlan(
531-
{
532-
gherkinDocument,
533-
pickles,
534-
supportCodeLibrary,
535-
},
489+
{ testRunStartedId, gherkinDocument, pickles, supportCodeLibrary },
536490
{
537491
newId,
538492
}
@@ -566,11 +520,7 @@ describe('makeTestPlan', () => {
566520
.build()
567521

568522
const result = makeTestPlan(
569-
{
570-
gherkinDocument,
571-
pickles,
572-
supportCodeLibrary,
573-
},
523+
{ testRunStartedId, gherkinDocument, pickles, supportCodeLibrary },
574524
{
575525
newId,
576526
}
@@ -605,11 +555,7 @@ describe('makeTestPlan', () => {
605555
.build()
606556

607557
const result = makeTestPlan(
608-
{
609-
gherkinDocument,
610-
pickles,
611-
supportCodeLibrary,
612-
},
558+
{ testRunStartedId, gherkinDocument, pickles, supportCodeLibrary },
613559
{
614560
newId,
615561
}
@@ -657,6 +603,7 @@ describe('makeTestPlan', () => {
657603
id: '10',
658604
},
659605
],
606+
testRunStartedId,
660607
},
661608
},
662609
])

src/makeTestPlan.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ export function makeTestPlan(
3434
ingredients: TestPlanIngredients,
3535
options: TestPlanOptions = {}
3636
): AssembledTestPlan {
37-
const { gherkinDocument, pickles, supportCodeLibrary } = ingredients
37+
const { testRunStartedId, gherkinDocument, pickles, supportCodeLibrary } = ingredients
3838
const {
3939
newId = IdGenerator.uuid(),
4040
strategy = namingStrategy(
@@ -61,6 +61,7 @@ export function makeTestPlan(
6161
id: this.id,
6262
pickleId: pickle.id,
6363
testSteps: this.steps.map((step) => step.toMessage()),
64+
testRunStartedId,
6465
}
6566
},
6667
}

src/types.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -295,6 +295,10 @@ export type MatchedStep = {
295295
* @public
296296
*/
297297
export interface TestPlanIngredients {
298+
/**
299+
* Identifier for the test run within which this plan will be executed
300+
*/
301+
testRunStartedId: string
298302
/**
299303
* The Gherkin document that has been processed
300304
*/

0 commit comments

Comments
 (0)