fix(tests): derive script location from test directory for portability

This commit is contained in:
GitHub Actions
2025-12-09 15:34:43 +00:00
parent 2dee87d4ed
commit e7bf81fd71

View File

@@ -23,8 +23,11 @@ teardown() {
rm -rf "$TMPREPO"
}
REPO_ROOT=$(cd "$BATS_TEST_DIRNAME/../../../" && pwd)
SCRIPT="$REPO_ROOT/scripts/history-rewrite/validate_after_rewrite.sh"
## Prefer deriving the script location from the test directory rather than hard-coding
## repository root paths such as /projects/Charon. This is more portable across
## environments and CI runners (e.g., forks where the repo path is different).
SCRIPT_DIR=$(cd "$BATS_TEST_DIRNAME/.." && pwd -P)
SCRIPT="$SCRIPT_DIR/validate_after_rewrite.sh"
@test "validate_after_rewrite fails when backup branch is missing" {
run bash "$SCRIPT"