feat: add --test filter flag for targeted test runs#9
Merged
Conversation
TWD Contract Validation
23 passed · 41 failed · 3 warnings · 1 skipped Failed validations./contracts/users-3.0.json
./contracts/posts-3.1.json
./contracts/products-3.0.json
./contracts/events-3.1.json
|
TWD Contract Validation
23 passed · 41 failed · 3 warnings · 1 skipped Failed validations./contracts/users-3.0.json
./contracts/posts-3.1.json
./contracts/products-3.0.json
./contracts/events-3.1.json
|
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.
What
Adds a repeatable
--test "<value>"flag totwd-cli runthat runs only the tests whose full"Suite > test"path contains a filter value — for fast, targeted debugging from the CLI instead of always running the whole suite.Behavior
"Suite > test name"path, so passing adescribename runs all tests inside it — no separate flag needed.--testvalues are combined with OR.No tests matched filter(s): …, so a typo can't silently look like a pass. A partial match warns about the filters that matched nothing and proceeds.--testflag → unchanged behavior (fullrunAll()).How
src/filterTests.js—selectTestIds(handlers, filters)matches in Node, reusing the existingbuildTestPathhelper.src/parseArgs.js—parseRunArgs(argv)parses repeatable--test/--test=flags.src/index.js— when filtering, enumerates the in-browser registry (window.__TWD_STATE__.handlers), selects ids in Node, and runs them via the existingwindow.__testRunner.runByIds(ids)(which still runs parent-suitebeforeEach/afterEachhooks) instead ofrunAll().bin/twd-cli.js— wires the flag in and documents it in--help.README.md— new "Filtering tests" section.No new dependencies.
Testing
selectTestIdsandparseRunArgs.runTeststests: filtered run callsrunByIdswith the matched ids; zero-match returns exit 1 without running; coverage skipped under filter; partial-match warning.Design spec and implementation plan are committed under
docs/superpowers/.🤖 Generated with Claude Code