cucumber-js icon indicating copy to clipboard operation
cucumber-js copied to clipboard

Enchanced features filter

Open epszaw opened this issue 3 years ago • 3 comments

🤔 What's changed?

The PR introduces runtime filters to enhance specs filtering not only be path or scenario, but by any Pickle message field:

module.exports = {
  default: {
    include: (pickle) => pickle.tags.includes('foo'),
    exclude: (pickle) => pickle.id === '...',
  }
}

⚡️ What's your motivation?

With the change we can use some good Allure features such as re-run with for cucumber-js.

🏷️ What kind of change is this?

  • :zap: New feature (non-breaking change which adds new behaviour)

♻️ Anything particular you want feedback on?

I'm not sure about the place where I added the fields. I decided to place them into IRunOptions.runtime because we use them in the runtime.

📋 Checklist:

  • [x] I agree to respect and uphold the Cucumber Community Code of Conduct
  • [x] I've changed the behaviour of the code
    • [x] 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.

This text was originally generated from a template, then edited by hand. You can modify the template here.

epszaw avatar Sep 06 '22 15:09 epszaw

Coverage Status

Coverage increased (+0.003%) to 98.239% when pulling 1165e5ec67866d8d9c28075dadd622eebc69c86b on lamartire:enchanced-features-filter into 01368ca6e3c9b097a7a88bb72de5beeddb4a0326 on cucumber:main.

coveralls avatar Sep 06 '22 15:09 coveralls

Thanks for raising @lamartire

We've been working on a plugins mechanism recently and the use case of "filter/order pickles in a custom way" is one that we identified would be a good fit to enable via plugins.

I just want to understand your use case a bit better though - from some of the things you've said, it seems like you might be running Cucumber programatically as part of a bigger framework, is that the case?

davidjgoss avatar Sep 07 '22 12:09 davidjgoss

Thanks for raising @lamartire

We've been working on a plugins mechanism recently and the use case of "filter/order pickles in a custom way" is one that we identified would be a good fit to enable via plugins.

I just want to understand your use case a bit better though - from some of the things you've said, it seems like you might be running Cucumber programatically as part of a bigger framework, is that the case?

We want to create seamless integration for allure and cucumber-js and one of the most important features is filtering specs by unique predicate (much more specific, than path, or name) when we need to perform re-run.

Plugins could be the solution, as far as I see. Could you please share some details about the API to estimate a sense of the PR? :)

epszaw avatar Sep 07 '22 12:09 epszaw