Skip to content

Add --packages / --exclude-packages to the test command - #10

Merged
davidanthoff merged 1 commit into
mainfrom
package-selection-flags
Oct 2, 2026
Merged

davidanthoff merged 1 commit into
mainfrom
package-selection-flags

Conversation

@davidanthoff

Copy link
Copy Markdown
Member

Opened by Claude (Claude Code), at David's request. Companion to julia-testitems/TestItemApp.jl#25, which adds the same two flags to juliati; the two are independent and can merge in either order.

Why

A question on Slack asked how to run the tests of every sub-project of a Pkg [workspace] from the root — "it'd be cool if there was a ] test --recursive". In this framework that problem does not exist: discovery is a folder walk, not a package dependency traversal, so test at a monorepo or workspace root already runs every package below it, each in its own test environment.

What was missing is the other direction — narrowing a run to the member you are working on, without paying to activate and precompile the rest. test had --name and --tags but no package filter at all.

What

test run --packages=A,B
test run --exclude-packages=Integration
test list --packages=A

_package_filter turns the two values into the predicate _build_run_kwargs already builds (which is handed a package_name as it is) and into the description the Selected N of M after filtering ... line prints. test list uses the same helper, so listing and running agree about what --packages means. Names match exactly and case sensitively, include is applied before exclude, and an item belonging to no package is never selected by --packages. Help text, README and tab completion updated.

A typo needs no special handling: the existing No test item matched the filter on packages Foo. Use 'test list' to see what is there. covers it.

Testing

57/57 test items pass. New coverage: _package_filter for include/exclude/both, case sensitivity, the no-package case and empty-name rejection; _build_run_kwargs composing the selection with --name and naming both in the description; a real test run --packages= through the REPL parser, including the no-match message; test list --packages=; and the flag-completion lists (test run -- and, newly asserted, test list --).

🤖 Generated with Claude Code

Discovery is a folder walk, not a package dependency traversal, so `test` at
the root of a monorepo or a Pkg `[workspace]` already covers every package
below it, each in its own test environment. What was missing was the other
direction: narrowing a run to the member being worked on, without paying to
activate and precompile the rest.

The `test` command had `--name` and `--tags` but no package filter at all, even
though the predicate `_build_run_kwargs` builds is already handed a
`package_name`. `_package_filter` turns the two new values into that predicate
and into the description the "Selected N of M after filtering ..." line prints;
`test list` uses the same helper so listing and running agree.

Names match exactly and case sensitively, as Julia package names are, include
is applied before exclude, and an item that belongs to no package is never
selected by `--packages`.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
@davidanthoff
davidanthoff merged commit 02332e0 into main Oct 2, 2026
18 of 20 checks passed
@davidanthoff
davidanthoff deleted the package-selection-flags branch October 2, 2026 17:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant