Skip to content

Exit code for bats:focus is not always 1 #1044

@mkonig

Description

@mkonig

Describe the bug
When using bats:focus the exit code is supposed to be 1 no matter what the test result is.

If one uses bats:focus on a test that is filtered out with --filter-tags bats will still
print 'WARNING: This test run only contains tests tagged bats:focus!'.
But bats will not run any tests because the only test that is supposed to be run is filtered out.
The exit code in this case is not 1 but 0.

To Reproduce
Create 2 passing tests.
Mark one with
# bats test_tags=test1,bats:focus
The other with
# bats test_tags=test2

Run
bats --filter-tags "test2"

Expected behavior
The exit code should be 1 because the bats:focus flag is set.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Component: Bash CodeEverything regarding the bash codePriority: CriticalBroken behavior in nearly all environments, e.g. wrong test results, internal bats errorSize: MediumChanges in the same fileStatus: ConfirmedThe reproducer worked as describedType: Bug

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions