@@ -86,6 +86,62 @@ describe("install.sh", () => {
8686 expect ( result . stdout + result . stderr ) . toContain ( "Missing value for --version" ) ;
8787 } ) ;
8888
89+ it ( "writes git install wrappers with the resolved Node runtime" , ( ) => {
90+ const result = runInstallShell ( `
91+ set -euo pipefail
92+ source "${ SCRIPT_PATH } "
93+ tmp="$(mktemp -d)"
94+ repo="$tmp/repo"
95+ node_dir="node-bin"
96+ cd "$tmp"
97+ mkdir -p "$repo/.git" "$repo/dist" "$node_dir"
98+ touch "$repo/dist/entry.js"
99+ cat > "$node_dir/node" <<'NODE'
100+ #!/usr/bin/env bash
101+ printf 'fake-node:%s\\n' "$*"
102+ NODE
103+ chmod +x "$node_dir/node"
104+ PATH="$node_dir:/usr/bin:/bin"
105+ export PATH
106+ OS=macos
107+ check_git() { return 0; }
108+ ensure_pnpm() { :; }
109+ ensure_pnpm_binary_for_scripts() { :; }
110+ resolve_git_openclaw_ref() { printf 'main\\n'; }
111+ checkout_git_openclaw_ref() { :; }
112+ cleanup_legacy_submodules() { :; }
113+ activate_repo_pnpm_version() { :; }
114+ git_install_lockfile_flag() { printf '%s\\n' '--frozen-lockfile'; }
115+ run_quiet_step() { return 0; }
116+ ensure_user_local_bin_on_path() {
117+ mkdir -p "$HOME/.local/bin"
118+ export PATH="$HOME/.local/bin:$PATH"
119+ }
120+ ui_info() { :; }
121+ ui_success() { :; }
122+ ui_error() { printf 'error:%s\\n' "$*"; }
123+ git() {
124+ if [[ "$1" == "-C" && "$3" == "status" ]]; then
125+ return 0
126+ fi
127+ printf 'unexpected git:%s\\n' "$*" >&2
128+ return 1
129+ }
130+
131+ install_openclaw_from_git "$repo"
132+ wrapper="$HOME/.local/bin/openclaw"
133+ grep -F "$tmp/$node_dir/node" "$wrapper"
134+ cd /
135+ PATH="/usr/bin:/bin" "$wrapper" --version
136+ ` ) ;
137+
138+ expect ( result . status ) . toBe ( 0 ) ;
139+ expect ( result . stdout ) . toContain ( "exec " ) ;
140+ expect ( result . stdout ) . toContain ( "/node-bin/node" ) ;
141+ expect ( result . stdout ) . toContain ( "fake-node:" ) ;
142+ expect ( result . stdout ) . toContain ( "/repo/dist/entry.js --version" ) ;
143+ } ) ;
144+
89145 it ( "accepts GNU and musl Linux shells in OS detection" , ( ) => {
90146 expect ( script ) . toContain ( '[[ "$OSTYPE" == "linux"* ]]' ) ;
91147 expect ( script ) . not . toContain ( '[[ "$OSTYPE" == "linux-gnu"* ]]' ) ;
0 commit comments