diff --git a/CHANGELOG.md b/CHANGELOG.md index 0dd8badee..ab7f6a046 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,7 +8,8 @@ and this project adheres to [Semantic Versioning](http://semver.org/). Please see [CONTRIBUTING.md](https://github.com/cucumber/cucumber/blob/master/CONTRIBUTING.md) on how to contribute to Cucumber. ## [Unreleased] -## Changed +### Changed +- Add `workerId` property to `testCaseStarted` message ([#2085](https://github.com/cucumber/cucumber-js/pull/2085)) - Handle stack traces without V8-specific modification ([#2119](https://github.com/cucumber/cucumber-js/pull/2119)) ## [8.7.0] - 2022-10-17 diff --git a/docs/parallel.md b/docs/parallel.md index 4e26ad961..e8135e9b0 100644 --- a/docs/parallel.md +++ b/docs/parallel.md @@ -9,9 +9,9 @@ The number you provide is the number of workers that will run scenarios in paral Each worker receives the following env variables (as well as a copy of `process.env` from the coordinator process): -* `CUCUMBER_PARALLEL` - set to 'true' -* `CUCUMBER_TOTAL_WORKERS` - set to the number of workers -* `CUCUMBER_WORKER_ID` - ID for worker ('0', '1', '2', etc.) +- `CUCUMBER_PARALLEL` - set to 'true' +- `CUCUMBER_TOTAL_WORKERS` - set to the number of workers +- `CUCUMBER_WORKER_ID` - ID for worker ('0', '1', '2', etc.) ### Timing @@ -32,36 +32,70 @@ When using parallel mode, any `BeforeAll` and `AfterAll` hooks you have defined If you would like to prevent specific sets of scenarios from running in parallel you can use `setParallelCanAssign`. Example: + ```javascript -setParallelCanAssign(function(pickleInQuestion, picklesInProgress) { +setParallelCanAssign(function (pickleInQuestion, picklesInProgress) { // Only one pickle with the word example in the name can run at a time - if (pickleInQuestion.name.includes("example")) { - return picklesInProgress.every(p => !p.name.includes("example")); + if (pickleInQuestion.name.includes('example')) { + return picklesInProgress.every((p) => !p.name.includes('example')) } // No other restrictions - return true; + return true }) ``` For convenience, the following helpers exist to build a `canAssignFn`: ```javascript -import { setParallelCanAssign, parallelCanAssignHelpers } from '@cucumber/cucumber' +import { + setParallelCanAssign, + parallelCanAssignHelpers, +} from '@cucumber/cucumber' const { atMostOnePicklePerTag } = parallelCanAssignHelpers -const myTagRule = atMostOnePicklePerTag(["@tag1", "@tag2"]); +const myTagRule = atMostOnePicklePerTag(['@tag1', '@tag2']) // Only one pickle with @tag1 can run at a time // AND only one pickle with @tag2 can run at a time setParallelCanAssign(myTagRule) // If you want to join a tag rule with other rules you can compose them like so: -const myCustomRule = function(pickleInQuestion, picklesInProgress) { +const myCustomRule = function (pickleInQuestion, picklesInProgress) { // ... -}; +} -setParallelCanAssign(function(pickleInQuestion, picklesInProgress) { - return myCustomRule(pickleInQuestion, picklesInProgress) && - myTagRule(pickleInQuestion, picklesInProgress); +setParallelCanAssign(function (pickleInQuestion, picklesInProgress) { + return ( + myCustomRule(pickleInQuestion, picklesInProgress) && + myTagRule(pickleInQuestion, picklesInProgress) + ) }) ``` + +### Formatting + +You can access `workerId` property in `testCaseStarted` envelope object: + +```javascript +const { Formatter } = require('@cucumber/cucumber') + +class ExampleFormatter extends Formatter { + constructor(options) { + options.eventBroadcaster.on('envelope', (envelope) => { + if (envelope.testCaseStarted) { + if (envelope.testCaseStarted.workerId) { + console.log( + `the event has been fired from a worker with id ${envelope.testCaseStarted.workerId}` + ) + } else { + console.log('the event has been sent from the main thread') + } + } + }) + + super(options) + } +} + +module.exports = ExampleFormatter +``` diff --git a/features/parallel.feature b/features/parallel.feature index cc2f92045..7cef38f97 100644 --- a/features/parallel.feature +++ b/features/parallel.feature @@ -55,3 +55,25 @@ Feature: Running scenarios in parallel my error """ Then it fails + + Scenario: `testCaseStarted` envelope from workers contains `workerId` parameter + Given a file named "features/step_definitions/cucumber_steps.js" with: + """ + const {Given} = require('@cucumber/cucumber') + + Given(/^a slow step$/, function(callback) { + setTimeout(callback, 1000) + }) + """ + And a file named "features/a.feature" with: + """ + Feature: slow + Scenario: a + Given a slow step + + Scenario: b + Given a slow step + """ + When I run cucumber-js with `--parallel 2` + Then it passes + And `testCaseStarted` envelope has `workerId` diff --git a/features/step_definitions/parallel_steps.ts b/features/step_definitions/parallel_steps.ts index e97c156f7..c5facfb3d 100644 --- a/features/step_definitions/parallel_steps.ts +++ b/features/step_definitions/parallel_steps.ts @@ -55,3 +55,11 @@ Then( expect(actualSets).to.eql(expectedSets) } ) + +Then('`testCaseStarted` envelope has `workerId`', function (this: World) { + const testCaseStartedEnvelope = this.lastRun.envelopes.find( + (envelope) => envelope.testCaseStarted + ) + + expect(testCaseStartedEnvelope.testCaseStarted).to.ownProperty('workerId') +}) diff --git a/package-lock.json b/package-lock.json index 389234e31..c3a033f8a 100644 --- a/package-lock.json +++ b/package-lock.json @@ -16,7 +16,7 @@ "@cucumber/gherkin-utils": "8.0.1", "@cucumber/html-formatter": "20.1.0", "@cucumber/message-streams": "4.0.1", - "@cucumber/messages": "19.1.4", + "@cucumber/messages": "20.0.0", "@cucumber/tag-expressions": "4.1.0", "assertion-error-formatter": "^3.0.0", "capital-case": "^1.0.4", @@ -594,6 +594,17 @@ "gherkin-utils": "bin/gherkin-utils" } }, + "node_modules/@cucumber/gherkin-utils/node_modules/@cucumber/messages": { + "version": "19.1.4", + "resolved": "https://registry.npmjs.org/@cucumber/messages/-/messages-19.1.4.tgz", + "integrity": "sha512-Pksl0pnDz2l1+L5Ug85NlG6LWrrklN9qkMxN5Mv+1XZ3T6u580dnE6mVaxjJRdcOq4tR17Pc0RqIDZMyVY1FlA==", + "dependencies": { + "@types/uuid": "8.3.4", + "class-transformer": "0.5.1", + "reflect-metadata": "0.1.13", + "uuid": "9.0.0" + } + }, "node_modules/@cucumber/gherkin-utils/node_modules/commander": { "version": "9.4.1", "resolved": "https://registry.npmjs.org/commander/-/commander-9.4.1.tgz", @@ -602,6 +613,17 @@ "node": "^12.20.0 || >=14" } }, + "node_modules/@cucumber/gherkin/node_modules/@cucumber/messages": { + "version": "19.1.4", + "resolved": "https://registry.npmjs.org/@cucumber/messages/-/messages-19.1.4.tgz", + "integrity": "sha512-Pksl0pnDz2l1+L5Ug85NlG6LWrrklN9qkMxN5Mv+1XZ3T6u580dnE6mVaxjJRdcOq4tR17Pc0RqIDZMyVY1FlA==", + "dependencies": { + "@types/uuid": "8.3.4", + "class-transformer": "0.5.1", + "reflect-metadata": "0.1.13", + "uuid": "9.0.0" + } + }, "node_modules/@cucumber/html-formatter": { "version": "20.1.0", "resolved": "https://registry.npmjs.org/@cucumber/html-formatter/-/html-formatter-20.1.0.tgz", @@ -619,9 +641,9 @@ } }, "node_modules/@cucumber/messages": { - "version": "19.1.4", - "resolved": "https://registry.npmjs.org/@cucumber/messages/-/messages-19.1.4.tgz", - "integrity": "sha512-Pksl0pnDz2l1+L5Ug85NlG6LWrrklN9qkMxN5Mv+1XZ3T6u580dnE6mVaxjJRdcOq4tR17Pc0RqIDZMyVY1FlA==", + "version": "20.0.0", + "resolved": "https://registry.npmjs.org/@cucumber/messages/-/messages-20.0.0.tgz", + "integrity": "sha512-JFrFwuhxsbig0afaViNhuzoQyC+GQzlI7m+rX+lSiDGV13K3sJzMmHjkbCiNOgoRlKAMwIGR9TRMH0xj9/My0w==", "dependencies": { "@types/uuid": "8.3.4", "class-transformer": "0.5.1", @@ -639,6 +661,18 @@ "@teppeis/multimaps": "2.0.0" } }, + "node_modules/@cucumber/query/node_modules/@cucumber/messages": { + "version": "19.1.4", + "resolved": "https://registry.npmjs.org/@cucumber/messages/-/messages-19.1.4.tgz", + "integrity": "sha512-Pksl0pnDz2l1+L5Ug85NlG6LWrrklN9qkMxN5Mv+1XZ3T6u580dnE6mVaxjJRdcOq4tR17Pc0RqIDZMyVY1FlA==", + "dev": true, + "dependencies": { + "@types/uuid": "8.3.4", + "class-transformer": "0.5.1", + "reflect-metadata": "0.1.13", + "uuid": "9.0.0" + } + }, "node_modules/@cucumber/tag-expressions": { "version": "4.1.0", "resolved": "https://registry.npmjs.org/@cucumber/tag-expressions/-/tag-expressions-4.1.0.tgz", @@ -981,24 +1015,24 @@ "node": ">=0.10.0" } }, - "node_modules/@microsoft/tsdoc": { - "version": "0.14.1", - "resolved": "https://registry.npmjs.org/@microsoft/tsdoc/-/tsdoc-0.14.1.tgz", - "integrity": "sha512-6Wci+Tp3CgPt/B9B0a3J4s3yMgLNSku6w5TV6mN+61C71UqsRBv2FUibBf3tPGlNxebgPHMEUzKpb1ggE8KCKw==", - "dev": true - }, "node_modules/@microsoft/tsdoc-config": { - "version": "0.16.1", - "resolved": "https://registry.npmjs.org/@microsoft/tsdoc-config/-/tsdoc-config-0.16.1.tgz", - "integrity": "sha512-2RqkwiD4uN6MLnHFljqBlZIXlt/SaUT6cuogU1w2ARw4nKuuppSmR0+s+NC+7kXBQykd9zzu0P4HtBpZT5zBpQ==", + "version": "0.16.2", + "resolved": "https://registry.npmjs.org/@microsoft/tsdoc-config/-/tsdoc-config-0.16.2.tgz", + "integrity": "sha512-OGiIzzoBLgWWR0UdRJX98oYO+XKGf7tiK4Zk6tQ/E4IJqGCe7dvkTvgDZV5cFJUzLGDOjeAXrnZoA6QkVySuxw==", "dev": true, "dependencies": { - "@microsoft/tsdoc": "0.14.1", + "@microsoft/tsdoc": "0.14.2", "ajv": "~6.12.6", "jju": "~1.4.0", "resolve": "~1.19.0" } }, + "node_modules/@microsoft/tsdoc-config/node_modules/@microsoft/tsdoc": { + "version": "0.14.2", + "resolved": "https://registry.npmjs.org/@microsoft/tsdoc/-/tsdoc-0.14.2.tgz", + "integrity": "sha512-9b8mPpKrfeGRuhFH5iO1iwCLeIIsV6+H1sRfxbkoGXIyQE2BTsPd9zqSqQJ+pv5sJ/hT5M1zvOFL02MnEezFug==", + "dev": true + }, "node_modules/@microsoft/tsdoc-config/node_modules/resolve": { "version": "1.19.0", "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.19.0.tgz", @@ -4079,9 +4113,9 @@ } }, "node_modules/globals": { - "version": "13.15.0", - "resolved": "https://registry.npmjs.org/globals/-/globals-13.15.0.tgz", - "integrity": "sha512-bpzcOlgDhMG070Av0Vy5Owklpv1I6+j96GhUI7Rh7IzDCKLzboflLrrfqMu8NquDbiR4EOQk7XzJwqVJxicxog==", + "version": "13.17.0", + "resolved": "https://registry.npmjs.org/globals/-/globals-13.17.0.tgz", + "integrity": "sha512-1C+6nQRb1GwGMKm2dH/E7enFAMxGTmGI7/dEdhy/DNelv85w9B72t3uc5frtMNXIbzrarJJ/lTCjcaZwbLJmyw==", "dev": true, "dependencies": { "type-fest": "^0.20.2" @@ -4832,7 +4866,7 @@ "node_modules/jju": { "version": "1.4.0", "resolved": "https://registry.npmjs.org/jju/-/jju-1.4.0.tgz", - "integrity": "sha1-o6vicYryQaKykE+EpiWXDzia4yo=", + "integrity": "sha512-8wb9Yw966OSxApiCt0K3yNJL8pnNeIv+OEq2YMidz4FKP6nonSRoOXc80iXY4JaN2FC11B9qsNmDsm+ZOfMROA==", "dev": true }, "node_modules/js-sdsl": { @@ -4997,7 +5031,7 @@ "node_modules/lodash.isequal": { "version": "4.5.0", "resolved": "https://registry.npmjs.org/lodash.isequal/-/lodash.isequal-4.5.0.tgz", - "integrity": "sha1-QVxEePK8wwEgwizhDtMib30+GOA=", + "integrity": "sha512-pDo3lu8Jhfjqls6GkMgpahsF9kCyayhgykjyLMNFTKWrpVdAQtYyB4muAMWozBB4ig/dtWAmsMxLEI8wuz+DYQ==", "dev": true }, "node_modules/lodash.merge": { @@ -7330,9 +7364,9 @@ } }, "node_modules/ts-node/node_modules/acorn": { - "version": "8.8.0", - "resolved": "https://registry.npmjs.org/acorn/-/acorn-8.8.0.tgz", - "integrity": "sha512-QOxyigPVrpZ2GXT+PFyZTl6TtOFc5egxHIP9IlQ+RbupQuX4RkT/Bee4/kQuC02Xkzg84JcT7oLYtDIQxp+v7w==", + "version": "8.7.1", + "resolved": "https://registry.npmjs.org/acorn/-/acorn-8.7.1.tgz", + "integrity": "sha512-Xx54uLJQZ19lKygFXOWsscKUbsBZW0CPykPhVQdhIeIwrbPmJzqeASDInc8nKBnp/JT6igTs82qPXz069H8I/A==", "dev": true, "bin": { "acorn": "bin/acorn" @@ -7859,9 +7893,9 @@ } }, "node_modules/z-schema": { - "version": "5.0.2", - "resolved": "https://registry.npmjs.org/z-schema/-/z-schema-5.0.2.tgz", - "integrity": "sha512-40TH47ukMHq5HrzkeVE40Ad7eIDKaRV2b+Qpi2prLc9X9eFJFzV7tMe5aH12e6avaSS/u5l653EQOv+J9PirPw==", + "version": "5.0.4", + "resolved": "https://registry.npmjs.org/z-schema/-/z-schema-5.0.4.tgz", + "integrity": "sha512-gm/lx3hDzJNcLwseIeQVm1UcwhWIKpSB4NqH89pTBtFns4k/HDHudsICtvG05Bvw/Mv3jMyk700y5dadueLHdA==", "dev": true, "dependencies": { "lodash.get": "^4.4.2", @@ -7875,7 +7909,7 @@ "node": ">=8.0.0" }, "optionalDependencies": { - "commander": "^2.7.1" + "commander": "^2.20.3" } }, "node_modules/z-schema/node_modules/commander": { @@ -8238,6 +8272,19 @@ "integrity": "sha512-B48XrUod4y3SoXe6mv12q7U1zThUNSK3yHSm/hBJCJZ6RJUJhFk3FVMN/83qOEbsYZe6iG9v+4L1Myf8/q8C6g==", "requires": { "@cucumber/messages": "^19.1.4" + }, + "dependencies": { + "@cucumber/messages": { + "version": "19.1.4", + "resolved": "https://registry.npmjs.org/@cucumber/messages/-/messages-19.1.4.tgz", + "integrity": "sha512-Pksl0pnDz2l1+L5Ug85NlG6LWrrklN9qkMxN5Mv+1XZ3T6u580dnE6mVaxjJRdcOq4tR17Pc0RqIDZMyVY1FlA==", + "requires": { + "@types/uuid": "8.3.4", + "class-transformer": "0.5.1", + "reflect-metadata": "0.1.13", + "uuid": "9.0.0" + } + } } }, "@cucumber/gherkin-streams": { @@ -8261,6 +8308,17 @@ "source-map-support": "^0.5.21" }, "dependencies": { + "@cucumber/messages": { + "version": "19.1.4", + "resolved": "https://registry.npmjs.org/@cucumber/messages/-/messages-19.1.4.tgz", + "integrity": "sha512-Pksl0pnDz2l1+L5Ug85NlG6LWrrklN9qkMxN5Mv+1XZ3T6u580dnE6mVaxjJRdcOq4tR17Pc0RqIDZMyVY1FlA==", + "requires": { + "@types/uuid": "8.3.4", + "class-transformer": "0.5.1", + "reflect-metadata": "0.1.13", + "uuid": "9.0.0" + } + }, "commander": { "version": "9.4.1", "resolved": "https://registry.npmjs.org/commander/-/commander-9.4.1.tgz", @@ -8281,9 +8339,9 @@ "requires": {} }, "@cucumber/messages": { - "version": "19.1.4", - "resolved": "https://registry.npmjs.org/@cucumber/messages/-/messages-19.1.4.tgz", - "integrity": "sha512-Pksl0pnDz2l1+L5Ug85NlG6LWrrklN9qkMxN5Mv+1XZ3T6u580dnE6mVaxjJRdcOq4tR17Pc0RqIDZMyVY1FlA==", + "version": "20.0.0", + "resolved": "https://registry.npmjs.org/@cucumber/messages/-/messages-20.0.0.tgz", + "integrity": "sha512-JFrFwuhxsbig0afaViNhuzoQyC+GQzlI7m+rX+lSiDGV13K3sJzMmHjkbCiNOgoRlKAMwIGR9TRMH0xj9/My0w==", "requires": { "@types/uuid": "8.3.4", "class-transformer": "0.5.1", @@ -8299,6 +8357,20 @@ "requires": { "@cucumber/messages": "^19.0.0", "@teppeis/multimaps": "2.0.0" + }, + "dependencies": { + "@cucumber/messages": { + "version": "19.1.4", + "resolved": "https://registry.npmjs.org/@cucumber/messages/-/messages-19.1.4.tgz", + "integrity": "sha512-Pksl0pnDz2l1+L5Ug85NlG6LWrrklN9qkMxN5Mv+1XZ3T6u580dnE6mVaxjJRdcOq4tR17Pc0RqIDZMyVY1FlA==", + "dev": true, + "requires": { + "@types/uuid": "8.3.4", + "class-transformer": "0.5.1", + "reflect-metadata": "0.1.13", + "uuid": "9.0.0" + } + } } }, "@cucumber/tag-expressions": { @@ -8577,24 +8649,24 @@ } } }, - "@microsoft/tsdoc": { - "version": "0.14.1", - "resolved": "https://registry.npmjs.org/@microsoft/tsdoc/-/tsdoc-0.14.1.tgz", - "integrity": "sha512-6Wci+Tp3CgPt/B9B0a3J4s3yMgLNSku6w5TV6mN+61C71UqsRBv2FUibBf3tPGlNxebgPHMEUzKpb1ggE8KCKw==", - "dev": true - }, "@microsoft/tsdoc-config": { - "version": "0.16.1", - "resolved": "https://registry.npmjs.org/@microsoft/tsdoc-config/-/tsdoc-config-0.16.1.tgz", - "integrity": "sha512-2RqkwiD4uN6MLnHFljqBlZIXlt/SaUT6cuogU1w2ARw4nKuuppSmR0+s+NC+7kXBQykd9zzu0P4HtBpZT5zBpQ==", + "version": "0.16.2", + "resolved": "https://registry.npmjs.org/@microsoft/tsdoc-config/-/tsdoc-config-0.16.2.tgz", + "integrity": "sha512-OGiIzzoBLgWWR0UdRJX98oYO+XKGf7tiK4Zk6tQ/E4IJqGCe7dvkTvgDZV5cFJUzLGDOjeAXrnZoA6QkVySuxw==", "dev": true, "requires": { - "@microsoft/tsdoc": "0.14.1", + "@microsoft/tsdoc": "0.14.2", "ajv": "~6.12.6", "jju": "~1.4.0", "resolve": "~1.19.0" }, "dependencies": { + "@microsoft/tsdoc": { + "version": "0.14.2", + "resolved": "https://registry.npmjs.org/@microsoft/tsdoc/-/tsdoc-0.14.2.tgz", + "integrity": "sha512-9b8mPpKrfeGRuhFH5iO1iwCLeIIsV6+H1sRfxbkoGXIyQE2BTsPd9zqSqQJ+pv5sJ/hT5M1zvOFL02MnEezFug==", + "dev": true + }, "resolve": { "version": "1.19.0", "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.19.0.tgz", @@ -11010,9 +11082,9 @@ } }, "globals": { - "version": "13.15.0", - "resolved": "https://registry.npmjs.org/globals/-/globals-13.15.0.tgz", - "integrity": "sha512-bpzcOlgDhMG070Av0Vy5Owklpv1I6+j96GhUI7Rh7IzDCKLzboflLrrfqMu8NquDbiR4EOQk7XzJwqVJxicxog==", + "version": "13.17.0", + "resolved": "https://registry.npmjs.org/globals/-/globals-13.17.0.tgz", + "integrity": "sha512-1C+6nQRb1GwGMKm2dH/E7enFAMxGTmGI7/dEdhy/DNelv85w9B72t3uc5frtMNXIbzrarJJ/lTCjcaZwbLJmyw==", "dev": true, "requires": { "type-fest": "^0.20.2" @@ -11544,7 +11616,7 @@ "jju": { "version": "1.4.0", "resolved": "https://registry.npmjs.org/jju/-/jju-1.4.0.tgz", - "integrity": "sha1-o6vicYryQaKykE+EpiWXDzia4yo=", + "integrity": "sha512-8wb9Yw966OSxApiCt0K3yNJL8pnNeIv+OEq2YMidz4FKP6nonSRoOXc80iXY4JaN2FC11B9qsNmDsm+ZOfMROA==", "dev": true }, "js-sdsl": { @@ -11683,7 +11755,7 @@ "lodash.isequal": { "version": "4.5.0", "resolved": "https://registry.npmjs.org/lodash.isequal/-/lodash.isequal-4.5.0.tgz", - "integrity": "sha1-QVxEePK8wwEgwizhDtMib30+GOA=", + "integrity": "sha512-pDo3lu8Jhfjqls6GkMgpahsF9kCyayhgykjyLMNFTKWrpVdAQtYyB4muAMWozBB4ig/dtWAmsMxLEI8wuz+DYQ==", "dev": true }, "lodash.merge": { @@ -13427,9 +13499,9 @@ }, "dependencies": { "acorn": { - "version": "8.8.0", - "resolved": "https://registry.npmjs.org/acorn/-/acorn-8.8.0.tgz", - "integrity": "sha512-QOxyigPVrpZ2GXT+PFyZTl6TtOFc5egxHIP9IlQ+RbupQuX4RkT/Bee4/kQuC02Xkzg84JcT7oLYtDIQxp+v7w==", + "version": "8.7.1", + "resolved": "https://registry.npmjs.org/acorn/-/acorn-8.7.1.tgz", + "integrity": "sha512-Xx54uLJQZ19lKygFXOWsscKUbsBZW0CPykPhVQdhIeIwrbPmJzqeASDInc8nKBnp/JT6igTs82qPXz069H8I/A==", "dev": true }, "acorn-walk": { @@ -13830,12 +13902,12 @@ } }, "z-schema": { - "version": "5.0.2", - "resolved": "https://registry.npmjs.org/z-schema/-/z-schema-5.0.2.tgz", - "integrity": "sha512-40TH47ukMHq5HrzkeVE40Ad7eIDKaRV2b+Qpi2prLc9X9eFJFzV7tMe5aH12e6avaSS/u5l653EQOv+J9PirPw==", + "version": "5.0.4", + "resolved": "https://registry.npmjs.org/z-schema/-/z-schema-5.0.4.tgz", + "integrity": "sha512-gm/lx3hDzJNcLwseIeQVm1UcwhWIKpSB4NqH89pTBtFns4k/HDHudsICtvG05Bvw/Mv3jMyk700y5dadueLHdA==", "dev": true, "requires": { - "commander": "^2.7.1", + "commander": "^2.20.3", "lodash.get": "^4.4.2", "lodash.isequal": "^4.5.0", "validator": "^13.7.0" diff --git a/package.json b/package.json index 189dcb997..023c9722b 100644 --- a/package.json +++ b/package.json @@ -88,6 +88,7 @@ "Kevin Goslar ", "Kevin Kirsche ", "Kim, Jang-hwan ", + "Konstantin Epishev ", "kostya.misura ", "Krispin Schulz ", "Kushal Pisavadia", @@ -202,7 +203,7 @@ "@cucumber/gherkin-utils": "8.0.1", "@cucumber/html-formatter": "20.1.0", "@cucumber/message-streams": "4.0.1", - "@cucumber/messages": "19.1.4", + "@cucumber/messages": "20.0.0", "@cucumber/tag-expressions": "4.1.0", "assertion-error-formatter": "^3.0.0", "capital-case": "^1.0.4", diff --git a/src/runtime/parallel/worker.ts b/src/runtime/parallel/worker.ts index 11405ccb7..0c4259206 100644 --- a/src/runtime/parallel/worker.ts +++ b/src/runtime/parallel/worker.ts @@ -54,9 +54,11 @@ export default class Worker { this.sendMessage = sendMessage this.eventBroadcaster = new EventEmitter() this.eventBroadcaster.on('envelope', (envelope: messages.Envelope) => { - this.sendMessage({ - jsonEnvelope: JSON.stringify(envelope), - }) + // assign `workerId` property only for the `testCaseStarted` message + if (envelope.testCaseStarted) { + envelope.testCaseStarted.workerId = this.id + } + this.sendMessage({ jsonEnvelope: JSON.stringify(envelope) }) }) }