From e3fda695fea00fd820e356521e1ba400d1edd934 Mon Sep 17 00:00:00 2001 From: Chemi Atlow Date: Thu, 13 Aug 2026 16:26:26 +0300 Subject: [PATCH] test_runner: extend tag filter with boolean expression DSL Upgrades the experimental tag filter introduced by stage 1 to accept a boolean expression instead of a literal tag name. Grammar: `and`/`&&`, `or`/`||`, `not`/`!`, parentheses for grouping, and `*` wildcards inside identifiers. Standard precedence (`not > and > or`); binary operators are left-associative. Word forms require whitespace separation; punctuation forms do not. Untagged tests evaluate `false` for any include expression and `true` for `not X`, so excluding tags does not accidentally remove untagged tests. The flag and `testTagFilters` option are still repeatable; multiple expressions still AND together. Malformed expressions fail fast at the parent process at startup. Tag value validation tightens to reject whitespace, operator characters (`& | ! ( ) *`), and the reserved words `and`/`or`/`not` in any casing - a breaking change relative to the stage 1 ship, acceptable at Stability 1.0 (Early development). Signed-off-by: atlowChemi PR-URL: https://github.com/nodejs/node/pull/63054 Reviewed-By: Moshe Atlow Reviewed-By: Benjamin Gruenbaum --- doc/api/cli.md | 22 +- doc/api/test.md | 99 +++- doc/node.1 | 20 +- lib/internal/test_runner/runner.js | 35 +- lib/internal/test_runner/tag_filter.js | 452 ++++++++++++++++-- lib/internal/test_runner/utils.js | 18 +- test/parallel/test-runner-tag-filter-cli.mjs | 91 +++- .../test-runner-tag-filter-parser.mjs | 257 ++++++++++ test/parallel/test-runner-tags-events.mjs | 8 + .../test-runner-tags-experimental-warning.mjs | 2 +- test/parallel/test-runner-tags-validation.mjs | 29 +- 11 files changed, 928 insertions(+), 105 deletions(-) create mode 100644 test/parallel/test-runner-tag-filter-parser.mjs diff --git a/doc/api/cli.md b/doc/api/cli.md index 7e503bdde4f..71f91a82509 100644 --- a/doc/api/cli.md +++ b/doc/api/cli.md @@ -1480,7 +1480,7 @@ Enable module mocking in the test runner. This feature requires `--allow-worker` if used with the [Permission Model][]. -### `--experimental-test-tag-filter=` +### `--experimental-test-tag-filter=''`