@@ -20,22 +20,39 @@ check "dotnet shim handles missing auth helper" bash -c '
2020# Test that the shim scripts properly source auth-ado.sh
2121check " dotnet shim sources auth-ado.sh" grep -q " source.*auth-ado.sh" /usr/local/share/codespace-shims/dotnet
2222check " npm shim sources auth-ado.sh" grep -q " source.*auth-ado.sh" /usr/local/share/codespace-shims/npm
23+ check " pn shim sources auth-ado.sh" grep -q " source.*auth-ado.sh" /usr/local/share/codespace-shims/pn
2324check " corepack shim sources auth-ado.sh" grep -q " source.*auth-ado.sh" /usr/local/share/codespace-shims/corepack
2425
2526# Verify the shim directory is in PATH
2627check " shim directory in PATH" bash -c ' [[ ":$PATH:" == *":/usr/local/share/codespace-shims:"* ]]'
2728
2829# Verify that shell function shims are written to rc files (not just shim scripts)
2930check " npm shell function written to bash.bashrc" grep -q " npm()" /etc/bash.bashrc
31+ check " pn shell function written to bash.bashrc" grep -q " pn()" /etc/bash.bashrc
3032check " corepack shell function written to bash.bashrc" grep -q " corepack()" /etc/bash.bashrc
3133check " dotnet shell function written to bash.bashrc" grep -q " dotnet()" /etc/bash.bashrc
3234check " npm shell function on its own line in bash.bashrc" grep -q " ^npm()" /etc/bash.bashrc
3335
3436# Verify aliases include proper quoting and argument passing ($@)
3537check " dotnet alias has quoted path and passes args" grep -q ' dotnet() { ".*/dotnet" "\$@"; }' /etc/bash.bashrc
3638check " npm alias has quoted path and passes args" grep -q ' npm() { ".*/npm" "\$@"; }' /etc/bash.bashrc
39+ check " pn alias has quoted path and passes args" grep -q ' pn() { ".*/pn" "\$@"; }' /etc/bash.bashrc
3740check " corepack alias has quoted path and passes args" grep -q ' corepack() { ".*/corepack" "\$@"; }' /etc/bash.bashrc
3841
42+ check " pn shim delegates to the underlying pn command" bash -c '
43+ TEST_DIR=$(mktemp -d)
44+ trap "rm -rf \"$TEST_DIR\"" EXIT
45+ mkdir -p "$TEST_DIR/bin"
46+ printf "#!/bin/bash\nprintf \"%%s\\n\" \"\$@\" > \"%s/args\"\n" "$TEST_DIR" > "$TEST_DIR/bin/pn"
47+ chmod +x "$TEST_DIR/bin/pn"
48+
49+ PATH="/usr/local/share/codespace-shims:$TEST_DIR/bin:/usr/bin:/bin" \
50+ ACTIONS_ID_TOKEN_REQUEST_URL=test \
51+ /usr/local/share/codespace-shims/pn install --frozen-lockfile
52+
53+ diff -u <(printf "install\n--frozen-lockfile\n") "$TEST_DIR/args"
54+ '
55+
3956# Verify Corepack lifecycle commands target the real binary directory rather than the shim directory.
4057check " corepack enable targets the real binary directory" bash -c '
4158 TEST_DIR=$(mktemp -d)
0 commit comments