core icon indicating copy to clipboard operation
core copied to clipboard

Match all tags in filter

Open Saghen opened this issue 2 years ago • 5 comments

Description

Currently when providing multiple tags to the config.filters.tags, any test that matches at least one of the tags will be run. It would be helpful if we could have the option to run tests that match all of the tags. I originally built a plugin to achieve this behavior via .skip() but the default reporter logs skipped tests to the console, as it should of course. So alternatively, would it be possible to filter out a test in a plugin so that custom filters can be implemented?

Package version

"@japa/expect": "^1.1.4",
"@japa/run-failed-tests": "^1.0.7",
"@japa/runner": "^2.0.7",
"@japa/spec-reporter": "^1.1.12",

Relevant Information

async function (_, runner) {
  runner.onSuite((suite) => {
    suite.onTest((test) => {
      if (!doesTestMatchAllTags(test, tags)) test.skip()
    })
    suite.onGroup((group) => {
      for (const test of group.tests) {
        if (!doesTestMatchAllTags(test, tags)) test.skip()
      }
    })
  })
}

Saghen avatar May 13 '22 18:05 Saghen

Hey! Yup, seems like we need to open a few more APIs to allow filtering tests via plugins. I have added it to my todo

thetutlage avatar May 17 '22 05:05 thetutlage

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

stale[bot] avatar Jul 16 '22 07:07 stale[bot]

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

stale[bot] avatar Sep 17 '22 18:09 stale[bot]

@thetutlage Might be worth it to only enable the stale bot on issues with a tag such as not enough info. It seems there were a few other issues in this repo that were needlessly closed

Saghen avatar Sep 26 '22 05:09 Saghen

The current workflow works great for us. If an issue needs attention, usually the creator of the issue will remind us about it.

thetutlage avatar Sep 30 '22 04:09 thetutlage

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

stale[bot] avatar Nov 29 '22 05:11 stale[bot]

Friendly reminder that I'd still appreciate this feature

Saghen avatar Nov 29 '22 18:11 Saghen