test(bash): handle expected env diff
Bats now honors errexit inside functions run through run. Treat diff status 1 as expected environment changes so the helper returns the script status. Co-authored-by: Copilot <copilot@github.com>
This commit is contained in:
1 file changed
+7
-1
@@ -68,7 +68,13 @@ function execute_test_script() {
|
||||
currentEnvsAfter=$(env | sort)
|
||||
|
||||
# diff as unified +/- output without context before/after
|
||||
diff --unified=0 <(echo "$currentEnvsBefore") <(echo "$currentEnvsAfter")
|
||||
local diffStatus
|
||||
if diff --unified=0 <(echo "$currentEnvsBefore") <(echo "$currentEnvsAfter"); then
|
||||
:
|
||||
else
|
||||
diffStatus=$?
|
||||
[[ $diffStatus == 1 ]] || return "$diffStatus"
|
||||
fi
|
||||
|
||||
exit $exitCode
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user