From a674c5d1a35b98aebe34391ea7d9677bd3d4ee73 Mon Sep 17 00:00:00 2001 From: Chemi Atlow Date: Thu, 13 Aug 2026 16:26:26 +0300 Subject: [PATCH 1/4] 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 | 446 ++++++++++++++++-- lib/internal/test_runner/utils.js | 18 +- 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, 920 insertions(+), 97 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 2052f010f4bb..e213d055b8e9 100644 --- a/doc/api/cli.md +++ b/doc/api/cli.md @@ -1499,7 +1499,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=''` + +Resets every counter reported by [`statement.stat()`][] back to zero, except +`memused`, which reports current memory usage and cannot be reset. This +method is a wrapper around [`sqlite3_stmt_status()`][] and is useful for +measuring a specific workload without the counts accumulated by earlier +executions of the same prepared statement. + ### `statement.run([namedParameters][, ...anonymousParameters])` + +* `counter` {string} The name of the counter to read. One of: + + * `'fullscanStep'` The number of times SQLite has stepped forward in a table + as part of a full table scan. + * `'sort'` The number of sort operations that have occurred. + * `'autoindex'` The number of rows inserted into transient indices that were + created automatically to help joins run faster. + * `'vmStep'` The number of virtual machine operations executed by the + prepared statement. + * `'reprepare'` The number of times the statement has been automatically + reprepared due to schema changes or changes to bound parameters. + * `'run'` The number of execution cycles started by the prepared statement. + * `'filterMiss'` The number of times the Bloom filter returned a result that + required the join step to be processed as normal. + * `'filterHit'` The number of times a join step was bypassed because a Bloom + filter returned not-found. + * `'memused'` The approximate number of bytes of heap memory used to store + the prepared statement. + +* Returns: {number} The current value of the requested counter. + +Returns one of the runtime counters that SQLite tracks for this prepared +statement. This method is a wrapper around [`sqlite3_stmt_status()`][] and does +not reset the counter. Asserting that a statement does not perform a full table +scan (`statement.stat('fullscanStep') === 0`) is a useful check to guard +against degenerate performance. + +The `'filterMiss'` and `'filterHit'` counters require SQLite 3.38.0 or later. +Builds linked against an older SQLite with `--shared-sqlite` do not expose them, +and passing either name throws `ERR_INVALID_ARG_VALUE`. + ## Class: `SQLTagStore`