diff --git a/scripts/test-install-cli-unit.sh b/scripts/test-install-cli-unit.sh index 78e3db5..8559097 100644 --- a/scripts/test-install-cli-unit.sh +++ b/scripts/test-install-cli-unit.sh @@ -226,8 +226,7 @@ echo "==> case: install_openclaw_from_git uses run_pnpm" export GIT_UPDATE=0 export SHARP_IGNORE_GLOBAL_LIBVIPS=1 - deps_cmd="" - build_cmd="" + run_pnpm_calls=() ensure_git() { :; } ensure_pnpm() { set_pnpm_cmd echo pnpm; } @@ -237,17 +236,14 @@ echo "==> case: install_openclaw_from_git uses run_pnpm" emit_json() { :; } fail() { echo "FAIL: $*" >&2; exit 1; } run_pnpm() { - if [[ -z "$deps_cmd" ]]; then - deps_cmd="$1" - else - build_cmd="$1" - fi + run_pnpm_calls+=("$*") return 0 } install_openclaw_from_git "${repo}" - assert_eq "$deps_cmd" "-C" "install_openclaw_from_git deps command entry" - assert_nonempty "$build_cmd" "install_openclaw_from_git build command entry" + assert_eq "${run_pnpm_calls[0]}" "-C ${repo} install" "install_openclaw_from_git deps command" + assert_eq "${run_pnpm_calls[1]}" "-C ${repo} ui:build" "install_openclaw_from_git ui build command" + assert_eq "${run_pnpm_calls[2]}" "-C ${repo} build" "install_openclaw_from_git build command" test -x "${prefix}/bin/openclaw" ) diff --git a/scripts/test-install-sh-unit.sh b/scripts/test-install-sh-unit.sh index 7c7df2f..9cbb044 100644 --- a/scripts/test-install-sh-unit.sh +++ b/scripts/test-install-sh-unit.sh @@ -532,8 +532,7 @@ echo "==> case: install_openclaw_from_git (deps step uses run_pnpm function)" # shellcheck disable=SC2034 SHARP_IGNORE_GLOBAL_LIBVIPS=1 - deps_called=0 - deps_cmd="" + run_pnpm_steps=() check_git() { return 0; } install_git() { fail "install_git should not be called"; } @@ -550,16 +549,18 @@ echo "==> case: install_openclaw_from_git (deps step uses run_pnpm function)" run_quiet_step() { local _title="$1" shift - if [[ "${_title}" == "Installing dependencies" ]]; then - deps_called=1 - deps_cmd="${1:-}" + if [[ "${1:-}" == "run_pnpm" ]]; then + shift + run_pnpm_steps+=("$*") + return 0 fi "$@" >/dev/null 2>&1 || true } install_openclaw_from_git "${repo}" - assert_eq "$deps_called" "1" "install_openclaw_from_git dependencies step" - assert_eq "$deps_cmd" "run_pnpm" "install_openclaw_from_git dependencies command" + assert_eq "${run_pnpm_steps[0]}" "-C ${repo} install" "install_openclaw_from_git dependencies command" + assert_eq "${run_pnpm_steps[1]}" "-C ${repo} ui:build" "install_openclaw_from_git ui build command" + assert_eq "${run_pnpm_steps[2]}" "-C ${repo} build" "install_openclaw_from_git build command" ) echo "==> case: ensure_pnpm_git_prepare_allowlist (known dep added once)"