Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Request for the ability to run tests in a Package with a given tag from the command line #591

Open
dimsumthinking opened this issue Aug 1, 2024 · 3 comments
Labels
command-line experience enhancements to the command line interface enhancement New feature or request swiftpm-integration Swift Package Manager integration
Milestone

Comments

@dimsumthinking
Copy link

Description

When running tests for a package from the command-line using swift test I'd love a flag that allows me to run the tests for a given tag.

It would also be nice to be able to write more complicated predicates so that I could run them for:

tag1. (just those whose tags include tag1)
~tag1 or !tag1 (all items who's tags do not include tag1)
no-tags (any untagged item)
tag1 & tag2 (must be tagged with both)
tag1 | tag2 (must be tagged with either)

Sorry if this is too vague - but I had to give up on the command line at the point that I just wanted to run tests for a given tag.

Expected behavior

No response

Actual behavior

No response

Steps to reproduce

No response

swift-testing version/commit hash

No response

Swift & OS version (output of swift --version && uname -a)

No response

@dimsumthinking dimsumthinking added the enhancement New feature or request label Aug 1, 2024
@grynspan grynspan added swiftpm-integration Swift Package Manager integration swift-6.1 labels Aug 1, 2024
@grynspan
Copy link
Contributor

grynspan commented Aug 2, 2024

It wouldn't be impossible to amend the existing --filter and --skip arguments to take tags so long as they're syntactically distinguishable from regular expressions representing (potentially partial) test IDs.

For instance, if we required a prefix tag:, that would not represent a valid test ID as no test ID should start with that prefix:

swift test --filter tag:critical

(This would also serve to automagically filter out all XCTest tests as no XCTest test ID can start with that string either.)

It wouldn't give us full boolean logic on tags, but building out what is effectively a parser/lexer just for parsing tags may be overkill.

@dimsumthinking
Copy link
Author

Thank you

using filter or skip the way you describe would certainly meet my needs.

@grynspan
Copy link
Contributor

Tracked internally by rdar://132989780.

@grynspan grynspan added this to the Swift 6.1 milestone Sep 10, 2024
@grynspan grynspan added the command-line experience enhancements to the command line interface label Sep 20, 2024
@grynspan grynspan modified the milestones: Swift 6.1, Swift 6.x Nov 19, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
command-line experience enhancements to the command line interface enhancement New feature or request swiftpm-integration Swift Package Manager integration
Projects
None yet
Development

No branches or pull requests

2 participants