Skip to content

Question: How is bashunit's proposed workflow to handle errors in set_up_before_script and tear_down_after_script functions? #489

@carlfriedrich

Description

@carlfriedrich

I have a set_up_before_script function which does a few things that might fail in certain circumstances (e.g. when a used command is not installed). When I set set -euo pipefail in these functions, bashunit simply exits with an error code, but without any message what went wrong. Is there a proposed workflow to handle errors in these functions?

For comparison: setting set -euo pipefail in a set_up function makes the test run continue on an error, with just the test marked as failed, but also without an error message.

Without setting set -euo pipefail, a failing command in a set_up or set_up_before_script function silently passes, without any notice of that failure.

IMO this is not ideal. In both cases bashunit should provide a useful error message when an error appears in a set_up or set_up_before_script function. And furthermore, the user should not be required to set set -euo pipefail themselves, or at least this should be noted as best practice somewhere in the docs (or any other proposed workflow).

Any opinions on this?

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

Projects

Status

Done

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions