Skip to content

A report path that is a directory fails silently and exits 0 #1177

Description

@Chemaclass

Problem

--report-junit adir (a forgotten filename) passes validation, because a
directory satisfies both -e and -w. The run then reaches the writer:

src/reports/junit.sh: line 44: adir: Is a directory

and exits 0. So the report is never written, the message names a bashunit
source file rather than the user's mistake, and CI stays green — a job that
publishes that report finds no file and nothing red to explain it.

A missing parent directory is caught properly (Error: … cannot be written,
exit 1), which is what makes the gap easy to miss.

Fix

Reject a directory in both writability checks, with a message that names the
actual mistake:

Error: BASHUNIT_REPORT_JSON is a directory, not a file: 'adir'.

"cannot be written" would send the reader to permissions; a directory is
almost always a forgotten filename.

Affects --report-junit, --report-json, --report-html, --report-md,
--log-junit and the bench equivalents — all five now exit 1.

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

Status
Done

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions