Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add an additional argument setParallelCanAssign #2232

Open
wants to merge 6 commits into
base: main
Choose a base branch
from

Conversation

limaAniceto
Copy link

@limaAniceto limaAniceto commented Feb 6, 2023

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?

  • 🏦 Refactoring/debt/DX (improvement to code design, tooling, documentation etc. without changing behaviour)
  • ⚡ 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:

  • I agree to respect and uphold the Cucumber Community Code of Conduct
  • I've changed the behaviour of the code
    • I have added/updated tests to cover my changes.
  • My change requires a change to the documentation.
    • I have updated the documentation accordingly.
  • Users should know about my change
    • I have added an entry to the "Unreleased" section of the CHANGELOG, linking to this pull request.

@coveralls
Copy link

coveralls commented Feb 27, 2023

Coverage Status

Coverage: 98.561%. Remained the same when pulling 9212900 on limaAniceto:ma-parallel-add-worker into bf8f681 on cucumber:main.

@limaAniceto limaAniceto changed the title Draft: Add an additional argument setParallelCanAssign Add an additional argument setParallelCanAssign Feb 27, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants