diff --git a/CHANGELOG.md b/CHANGELOG.md index fab75b6..c25bd98 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] +### Added +- BREAKING CHANGE: Add `testRunStartedId` to `TestPlanIngredients` ([#3](https://github.com/cucumber/javascript-core/pull/3)) ## [0.1.0] - 2025-07-24 ### Added diff --git a/cucumber-core.api.md b/cucumber-core.api.md index fa0f08b..1f477b2 100644 --- a/cucumber-core.api.md +++ b/cucumber-core.api.md @@ -170,6 +170,7 @@ export interface TestPlanIngredients { gherkinDocument: GherkinDocument; pickles: ReadonlyArray; supportCodeLibrary: SupportCodeLibrary; + testRunStartedId: string; } // @public diff --git a/src/makeTestPlan.spec.ts b/src/makeTestPlan.spec.ts index 83e3085..62e8cd7 100644 --- a/src/makeTestPlan.spec.ts +++ b/src/makeTestPlan.spec.ts @@ -37,7 +37,7 @@ function parseGherkin( describe('makeTestPlan', () => { class FakeWorld {} - + const testRunStartedId = 'run-id' let newId: () => string beforeEach(() => { @@ -51,6 +51,7 @@ describe('makeTestPlan', () => { const result = makeTestPlan( { + testRunStartedId, gherkinDocument, pickles, supportCodeLibrary, @@ -69,6 +70,7 @@ describe('makeTestPlan', () => { const result = makeTestPlan( { + testRunStartedId, gherkinDocument, pickles, supportCodeLibrary, @@ -86,11 +88,7 @@ describe('makeTestPlan', () => { const supportCodeLibrary = buildSupportCode({ newId }).build() const result = makeTestPlan( - { - gherkinDocument, - pickles, - supportCodeLibrary, - }, + { testRunStartedId, gherkinDocument, pickles, supportCodeLibrary }, { newId, } @@ -111,11 +109,7 @@ describe('makeTestPlan', () => { const supportCodeLibrary = buildSupportCode({ newId }).build() const result = makeTestPlan( - { - gherkinDocument, - pickles, - supportCodeLibrary, - }, + { testRunStartedId, gherkinDocument, pickles, supportCodeLibrary }, { newId, strategy: { @@ -154,11 +148,7 @@ describe('makeTestPlan', () => { .build() const result = makeTestPlan( - { - gherkinDocument, - pickles, - supportCodeLibrary, - }, + { testRunStartedId, gherkinDocument, pickles, supportCodeLibrary }, { newId, } @@ -172,11 +162,7 @@ describe('makeTestPlan', () => { const supportCodeLibrary = buildSupportCode({ newId }).build() const result = makeTestPlan( - { - gherkinDocument, - pickles, - supportCodeLibrary, - }, + { testRunStartedId, gherkinDocument, pickles, supportCodeLibrary }, { newId, } @@ -201,11 +187,7 @@ describe('makeTestPlan', () => { .build() const result = makeTestPlan( - { - gherkinDocument, - pickles, - supportCodeLibrary, - }, + { testRunStartedId, gherkinDocument, pickles, supportCodeLibrary }, { newId, } @@ -235,11 +217,7 @@ describe('makeTestPlan', () => { .build() const result = makeTestPlan( - { - gherkinDocument, - pickles, - supportCodeLibrary, - }, + { testRunStartedId, gherkinDocument, pickles, supportCodeLibrary }, { newId, } @@ -269,11 +247,7 @@ describe('makeTestPlan', () => { .build() const result = makeTestPlan( - { - gherkinDocument, - pickles, - supportCodeLibrary, - }, + { testRunStartedId, gherkinDocument, pickles, supportCodeLibrary }, { newId, } @@ -308,11 +282,7 @@ describe('makeTestPlan', () => { .build() const result = makeTestPlan( - { - gherkinDocument, - pickles, - supportCodeLibrary, - }, + { testRunStartedId, gherkinDocument, pickles, supportCodeLibrary }, { newId, } @@ -359,11 +329,7 @@ describe('makeTestPlan', () => { .build() const result = makeTestPlan( - { - gherkinDocument, - pickles, - supportCodeLibrary, - }, + { testRunStartedId, gherkinDocument, pickles, supportCodeLibrary }, { newId, } @@ -414,11 +380,7 @@ describe('makeTestPlan', () => { .build() const result = makeTestPlan( - { - gherkinDocument, - pickles, - supportCodeLibrary, - }, + { testRunStartedId, gherkinDocument, pickles, supportCodeLibrary }, { newId, } @@ -484,11 +446,7 @@ describe('makeTestPlan', () => { .build() const result = makeTestPlan( - { - gherkinDocument, - pickles, - supportCodeLibrary, - }, + { testRunStartedId, gherkinDocument, pickles, supportCodeLibrary }, { newId, } @@ -528,11 +486,7 @@ describe('makeTestPlan', () => { .build() const result = makeTestPlan( - { - gherkinDocument, - pickles, - supportCodeLibrary, - }, + { testRunStartedId, gherkinDocument, pickles, supportCodeLibrary }, { newId, } @@ -566,11 +520,7 @@ describe('makeTestPlan', () => { .build() const result = makeTestPlan( - { - gherkinDocument, - pickles, - supportCodeLibrary, - }, + { testRunStartedId, gherkinDocument, pickles, supportCodeLibrary }, { newId, } @@ -605,11 +555,7 @@ describe('makeTestPlan', () => { .build() const result = makeTestPlan( - { - gherkinDocument, - pickles, - supportCodeLibrary, - }, + { testRunStartedId, gherkinDocument, pickles, supportCodeLibrary }, { newId, } @@ -657,6 +603,7 @@ describe('makeTestPlan', () => { id: '10', }, ], + testRunStartedId, }, }, ]) diff --git a/src/makeTestPlan.ts b/src/makeTestPlan.ts index 6a8fc9a..7a81da2 100644 --- a/src/makeTestPlan.ts +++ b/src/makeTestPlan.ts @@ -34,7 +34,7 @@ export function makeTestPlan( ingredients: TestPlanIngredients, options: TestPlanOptions = {} ): AssembledTestPlan { - const { gherkinDocument, pickles, supportCodeLibrary } = ingredients + const { testRunStartedId, gherkinDocument, pickles, supportCodeLibrary } = ingredients const { newId = IdGenerator.uuid(), strategy = namingStrategy( @@ -61,6 +61,7 @@ export function makeTestPlan( id: this.id, pickleId: pickle.id, testSteps: this.steps.map((step) => step.toMessage()), + testRunStartedId, } }, } diff --git a/src/types.ts b/src/types.ts index 12e983f..977a35d 100644 --- a/src/types.ts +++ b/src/types.ts @@ -295,6 +295,10 @@ export type MatchedStep = { * @public */ export interface TestPlanIngredients { + /** + * Identifier for the test run within which this plan will be executed + */ + testRunStartedId: string /** * The Gherkin document that has been processed */