cucumber-js
cucumber-js copied to clipboard
Add an additional argument setParallelCanAssign
Thanks for looking but this is still a draft PR!
🤔 What's changed?
Hi there, First of all thank you very much for maintaining/developing cucumber!
If possible, I'd like to propose the following change based on my own requirements and other people's that I've seen here in github :)
The change is adding an additional argument to setParallelCanAssign
which is an object with information regarding the worker
⚡️ What's your motivation?
Several folks have asked for the ability to run features
per runner, from my own use-case this is doable if we get the CUCUMBER_WORKER_ID
.
It should be available via process.env.CUCUMBER_ID
, however that is not actually the case, see:
// This prints the CUCUMBER_WORKER_ID correctly: 0 | 1 | 2 | ...
console.log("Outside -> Works", process.env.CUCUMBER_WORKER_ID);
setParallelCanAssign((pickleInQuestion, inProgress) => {
// Prints: undefined
console.log("Inside -> Does not Work", process.env.CUCUMBER_WORKER_ID);
return dontRunPicklesWithTag(pickleInQuestion, inProgress);
});
Therefore while looking at the source-code I realised it would be simple to add the worker information as an argument to the function (or more properties if needed later)
🏷️ What kind of change is this?
- :bank: Refactoring/debt/DX (improvement to code design, tooling, documentation etc. without changing behaviour)
- :zap: New feature (non-breaking change which adds new behaviour)
♻️ Anything particular you want feedback on?
Do you want an object with more information other than the worker?
📋 Checklist:
- [x] I agree to respect and uphold the Cucumber Community Code of Conduct
- [x] I've changed the behaviour of the code
- [ ] I have added/updated tests to cover my changes.
- [x] My change requires a change to the documentation.
- [x] I have updated the documentation accordingly.
- [x] Users should know about my change
- [ ] I have added an entry to the "Unreleased" section of the CHANGELOG, linking to this pull request.