Skip to content

[2.x] Fix #3746: Scripted should fail when no tests match the pattern#8457

Merged
eed3si9n merged 1 commit intosbt:developfrom
gayanMatch:fix/3746-scripted-fail-no-match
Jan 9, 2026
Merged

[2.x] Fix #3746: Scripted should fail when no tests match the pattern#8457
eed3si9n merged 1 commit intosbt:developfrom
gayanMatch:fix/3746-scripted-fail-no-match

Conversation

@gayanMatch
Copy link
Copy Markdown
Contributor

Summary

Fixes #3746

When running scripted foo/bar with a non-existent test pattern, sbt previously reported success even though zero tests were executed. This could mask typos in CI scripts.

Changes

  • Add validation in ScriptedRunner to fail when user provides test patterns but none match existing test directories
  • Change log message from "About to run tests" to "Tests selected" for clarity
  • Error message: No tests found matching: <pattern>

Test Plan

Before:

> scripted nonexistent/test
[info] About to run tests:
 * nonexistent/test
[success]

After:

> scripted nonexistent/test
[info] Tests selected:
 * nonexistent/test
[error] No tests found matching: nonexistent/test
  • Verified existing scripted tests still pass: sbt scripted actions/add-alias
  • Verified command fails on non-matching patterns
  • Backward compatible: running scripted without arguments still works

Contribution by Gittensor, see my contribution statistics at https://gittensor.io/miners/details?githubId=132382032

@eed3si9n eed3si9n changed the title Fix #3746: Scripted should fail when no tests match the pattern [2.x] Fix #3746: Scripted should fail when no tests match the pattern Jan 9, 2026
Copy link
Copy Markdown
Member

@eed3si9n eed3si9n left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

@gayanMatch
Copy link
Copy Markdown
Contributor Author

Thanks!

Thank you!

@gayanMatch
Copy link
Copy Markdown
Contributor Author

Hi @eed3si9n
The ClientTest failures appear to be flaky CI issues unrelated to this PR's scripted changes. Could a maintainer please re-run?

@gayanMatch
Copy link
Copy Markdown
Contributor Author

Hi @eed3si9n

curl -s "https://contribute.akka.io/contribute/cla/scala/check/gayanMatch" | jq
{
  "user": "gayanMatch",
  "signed": true,
  "version": "1.0",
  "currentVersion": "1.0"
}

I got this true for my CLA. But not sure why fail in scala cla check.
Could you please take a look on it?
Thank you

@SethTisue
Copy link
Copy Markdown
Member

The CLA check also succeeded on-rerun 👍

@gayanMatch
Copy link
Copy Markdown
Contributor Author

gayanMatch commented Jan 9, 2026

Thank you @SethTisue
Could you please merge?

@eed3si9n eed3si9n merged commit ba43e99 into sbt:develop Jan 9, 2026
22 of 24 checks passed
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.

Scripted should fail if argument is given, and no tests are matching

3 participants