Skip to content

A --tag that matches nothing gives no way to find the right tag #1265

Description

@Chemaclass

Problem

--filter explains itself when it selects nothing (#1237). --tag does not:

$ bashunit --tag integraton t_test.sh
 No tests found

Tags are worse off than filters. A filter matches a test function name, and those are visible in any normal run, so a typo is recoverable by looking at the output. A tag is a user-defined string that appears only in # @tag comments, and nothing lists them — there is no --list-tags, and --list --list-format json only reports the tags of tests it selected, which is empty precisely when you need them.

So a typo'd tag leaves the reader with no way to discover the right one short of grepping the suite.

Proposal

Name the tags the run actually saw:

No test matches tag 'integraton'. Tags in the selected files: integration,slow.

and when no test carries one at all, say that instead — it is a different mistake:

No test matches tag 'anything'. No test in the selected files carries a '# @tag'.

The tags map is cached per script, so only the last file's survives to the summary; accumulating the names as each file is scanned is per file, not per test, and costs no fork. The hint only prints on a run that already selected nothing.

Metadata

Metadata

Assignees

Labels

enhancementNew feature or request

Type

No type

Projects

Status
Done

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions