test_runner: add tags option and tag-name filter#63221
Open
atlowChemi wants to merge 1 commit intonodejs:mainfrom
Open
test_runner: add tags option and tag-name filter#63221atlowChemi wants to merge 1 commit intonodejs:mainfrom
atlowChemi wants to merge 1 commit intonodejs:mainfrom
Conversation
Collaborator
|
Review requested:
|
Adds a `tags` option to test(), it(), suite(), and describe() that accepts an array of string labels. Tags are canonicalized to lowercase and inherited from suites to nested tests by union. Reporter events expose the tag set on every test, and TestContext exposes the test's tags via `context.tags`. Filtering is done by literal tag name through the new `--experimental-test-tag-filter=<tag>` flag (or `testTagFilters` on run()). The flag may be specified more than once; tests must contain every filter to run. Untagged tests are excluded under any positive filter. The tagging mechanism is gated behind a one-shot ExperimentalWarning. Signed-off-by: atlowChemi <chemi@atlow.co.il>
4f4407b to
3d18efb
Compare
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #63221 +/- ##
========================================
Coverage 90.04% 90.04%
========================================
Files 713 714 +1
Lines 224950 225192 +242
Branches 42530 42564 +34
========================================
+ Hits 202548 202770 +222
+ Misses 14188 14185 -3
- Partials 8214 8237 +23
🚀 New features to boost your workflow:
|
This comment was marked as spam.
This comment was marked as spam.
This comment was marked as spam.
This comment was marked as spam.
This comment was marked as spam.
This comment was marked as spam.
MoLow
reviewed
May 10, 2026
| For each test that is executed, any corresponding test hooks, such as | ||
| `beforeEach()`, are also run. | ||
| **Default:** `undefined`. | ||
| * `testTagFilters` {string|string\[]} A tag name, or an array of tag names, |
Member
There was a problem hiding this comment.
should we accept a function as well?
Member
Author
There was a problem hiding this comment.
I don't think so.
That should be discussed in a follow up, as part of the DSL addition, IMHO
MoLow
approved these changes
May 10, 2026
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
Collaborator
Collaborator
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
tagsarray option totest(),it(),suite(),describe()with case-insensitive canonicalization and union inheritance from suites.
test:start,test:pass, etc.) andvia
context.tags.--experimental-test-tag-filter=<tag>andtestTagFiltersforliteral tag-name filtering. Multi-occurrence composes by AND.
Extracts the tagging mechanism from #63054 so the boolean expression
DSL can be discussed separately. The filter syntax here is a single
literal tag name.
One known caveat: tag values currently accept any non-empty string.
Adding the DSL later will require reserving operator characters
(
& | ! ( ) *) and the wordsand/or/not, which would be abreaking change. Acceptable since this ships at Stability 1.0
(Early development).