From 3f583b5a165e7fd11bbb9f38c11020905010e4b7 Mon Sep 17 00:00:00 2001 From: atlowChemi Date: Thu, 30 Apr 2026 19:24:30 +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 --- doc/api/cli.md | 22 +- doc/api/test.md | 99 +++- doc/node.1 | 8 +- lib/internal/test_runner/runner.js | 28 +- lib/internal/test_runner/tag_filter.js | 446 ++++++++++++++++-- lib/internal/test_runner/utils.js | 19 +- test/parallel/test-runner-tag-filter-cli.mjs | 81 +++- .../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, 905 insertions(+), 94 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 8f7d6185ac464c..b8619da43e7861 100644 --- a/doc/api/cli.md +++ b/doc/api/cli.md @@ -1413,7 +1413,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=''`