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

swift test list does not fail with unrecognized argument swift test options. #8069

Open
1 task done
bkhouri opened this issue Oct 23, 2024 · 0 comments
Open
1 task done
Labels
bug swift test Changes impacting `swift test` tool

Comments

@bkhouri
Copy link

bkhouri commented Oct 23, 2024

Is it reproducible with SwiftPM command-line tools: swift build, swift test, swift package etc?

  • Confirmed reproduction steps with SwiftPM CLI. The description text must include reproduction steps with either of command-line SwiftPM commands, swift build, swift test, swift package etc.

Description

swift test list command does not error when an unsupported argument is provided

The command line help for swift test list is

❯ swift test list --help     
OVERVIEW: Lists test methods in specifier format

USAGE: swift test list [--skip-build] [--enable-xctest] [--disable-xctest] [--enable-swift-testing] [--disable-swift-testing]

OPTIONS:
  --skip-build            Skip building the test target
  --enable-xctest/--disable-xctest
                          Enable support for XCTest
  --enable-swift-testing/--disable-swift-testing
                          Enable support for Swift Testing
  --version               Show the version.
  -h, -help, --help       Show help information.

However, running swift test list --filter foo does not error, while swift test list --unsupported-argument does.

Expected behavior

swift test list command line should either:

  • accept the swift test command line option and reflect said option in the output
  • error when the options do not match the swift test list --help

Actual behavior

swim test list currently accepts option from swift test but it not reflected in the output.

Steps to reproduce

Clone the repository

set -x
swift build
bin_path=$(swift build  --show-bin-path)
build_runner="${bin_path}/swift-build"
test_runner="${bin_path}/swift-test"

# build the repo to avoid compile warnings with the first `swift test list`
${build_runner}

# display the help to see a list of options
${test_runner} list --help


# display the actual tests returned by `grep` vs `--filter`
${test_runner} list | grep "WorkspaceTests"
${test_runner} list --filter "WorkspaceTests"

# Get a estimate of the number of tests returned by `grep` vs `--filter`
${test_runner} list | grep  "WorkspaceTests" | wc -l
${test_runner} list  --filter "WorkspaceTests" | wc -l

# Specify an argument that does not exist on `swift test` and it fails as expected
${test_runner} --non-existing-argument

set +x

Swift Package Manager version/commit hash

5efd210 (branch main)

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

No response

@bkhouri bkhouri added the bug label Oct 23, 2024
@bkhouri bkhouri changed the title swift test list does not fails with unrecognized argument swift test options. swift test list does not fail with unrecognized argument swift test options. Oct 23, 2024
@grynspan grynspan added the swift test Changes impacting `swift test` tool label Oct 23, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug swift test Changes impacting `swift test` tool
Projects
None yet
Development

No branches or pull requests

2 participants