Skip to content

Commit

Permalink
in case of a test run error (missing script), the run.sh script was n…
Browse files Browse the repository at this point in the history
…ot writing the result.json file
  • Loading branch information
glennj committed Jul 11, 2024
1 parent 498c0ec commit 3017121
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 14 deletions.
3 changes: 2 additions & 1 deletion bin/run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,8 @@ error() {
--argjson version "$INTERFACE_VERSION" \
--arg status "error" \
--arg message "$(< "$output_file")" \
'{version: $version, status: $status, message: $message}'
'{version: $version, status: $status, message: $message}' \
> "$json_result_file"

echo "Wrote error report to $json_result_file"
}
Expand Down
15 changes: 2 additions & 13 deletions tests/data/missing_script/expected_results.json
Original file line number Diff line number Diff line change
@@ -1,16 +1,5 @@
{
"version": 2,
"status": "fail",
"test-environment": {
"bash": "5.2.21(1)-release",
"bats": "Bats 1.5.0"
},
"tests": [
{
"name": "say hello",
"status": "fail",
"test_code": "run bash one_passing.sh\n[ \"$status\" -eq 0 ]\n[ \"$output\" == \"Hello, World!\" ]",
"message": "(in test file missing_script.bats, line 5)\n `[ \"$status\" -eq 0 ]' failed\n"
}
]
"status": "error",
"message": "1..1\nnot ok 1 say hello\n# (in test file missing_script.bats, line 5)\n# `[ \"$status\" -eq 0 ]' failed\n\nThe following warnings were encountered during tests:\nBW01: `run`'s command `bash one_passing.sh` exited with code 127, indicating 'Command not found'. Use run's return code checks, e.g. `run -127`, to fix this message.\n (from function `run' in file /home/linuxbrew/.linuxbrew/Cellar/bats-core/1.11.0/lib/bats-core/test_functions.bash, line 426,\n in test file missing_script.bats, line 4)"
}

0 comments on commit 3017121

Please sign in to comment.