Files
huskies/script/test
T
dave 3ff361bfe8 chore: silence git init defaultBranch hints in script/test
Tests that create temp repos call `git init` without specifying a branch.
Git then prints a 12-line "hint: Using 'master' as the name for the
initial branch..." block — every test, every run. The output drowns out
actual failures.

Set init.defaultBranch=master via GIT_CONFIG_COUNT/KEY/VALUE env vars in
script/test. This affects only subprocesses spawned by the test runner;
no change to the user's real git config.

Verified: cargo test --bin huskies emits 0 `hint:` lines after this
change, all 2732 tests still pass.
2026-04-28 16:38:43 +00:00

51 lines
1.6 KiB
Bash
Executable File

#!/usr/bin/env bash
set -euo pipefail
# Silence git's "default branch name" hints emitted on every `git init` in
# tests that create temp repos. Sets init.defaultBranch=master via env so we
# don't have to touch the user's real git config.
export GIT_CONFIG_COUNT=1
export GIT_CONFIG_KEY_0=init.defaultBranch
export GIT_CONFIG_VALUE_0=master
SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)"
PROJECT_ROOT="$(cd "$SCRIPT_DIR/.." && pwd)"
echo "=== Building frontend ==="
if [ -d "$PROJECT_ROOT/frontend" ]; then
cd "$PROJECT_ROOT/frontend"
npm install
npm run build
cd "$PROJECT_ROOT"
else
echo "Skipping frontend build (no frontend directory)"
fi
echo "=== Checking Rust formatting ==="
if cargo fmt --version &>/dev/null; then
cargo fmt --manifest-path "$PROJECT_ROOT/Cargo.toml" --all --check
else
echo "Skipping Rust formatting check (rustfmt not installed)"
fi
echo "=== Running cargo clippy ==="
cargo clippy --manifest-path "$PROJECT_ROOT/Cargo.toml" --all-targets --all-features -- -D warnings
echo "=== Running Rust tests ==="
cargo test --manifest-path "$PROJECT_ROOT/Cargo.toml" --bin huskies
echo "=== Running frontend unit tests ==="
if [ -d "$PROJECT_ROOT/frontend" ]; then
cd "$PROJECT_ROOT/frontend"
npm test
else
echo "Skipping frontend tests (no frontend directory)"
fi
# Disabled: e2e tests may be causing merge pipeline hangs (no running server
# in merge workspace → Playwright blocks indefinitely). Re-enable once confirmed.
# Disabled: e2e tests cause merge pipeline hangs (no running server
# in merge workspace → Playwright blocks indefinitely).
# echo "=== Running e2e tests ==="
# npm run test:e2e