Skip to content

Commit eaaaf0e

Browse files
committed
test(ci): add global package install tests to install workflow
Add tests that verify global package installation works correctly on all platforms (Linux, macOS, Windows, ARM64). Tests install typescript, verify the shim works, then uninstall and verify the shim file is removed.
1 parent aa9e498 commit eaaaf0e

1 file changed

Lines changed: 67 additions & 1 deletion

File tree

.github/workflows/test-install.yml

Lines changed: 67 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,31 @@ jobs:
9393
vp env doctor
9494
vp env run --node 24 -- node -p "process.versions"
9595
96+
- name: Test global package install
97+
run: |
98+
export PATH="$HOME/.vite-plus/bin:$PATH"
99+
100+
# Test 1: Install a JS-based CLI (typescript)
101+
npm install -g typescript
102+
tsc --version
103+
104+
# Test 2: Verify the package was installed correctly
105+
ls -la ~/.vite-plus/packages/typescript/
106+
ls -la ~/.vite-plus/bin/
107+
108+
# Test 3: Uninstall
109+
npm uninstall -g typescript
110+
111+
# Test 4: Verify uninstall removed shim
112+
echo "Checking bin dir after uninstall:"
113+
ls -la ~/.vite-plus/bin/
114+
echo "Checking if tsc shim file exists:"
115+
if [ -f ~/.vite-plus/bin/tsc ]; then
116+
echo "Error: tsc shim file still exists at ~/.vite-plus/bin/tsc"
117+
exit 1
118+
fi
119+
echo "tsc shim removed successfully"
120+
96121
test-install-sh-arm64:
97122
name: Test install.sh (Linux ARM64 glibc via QEMU)
98123
runs-on: ubuntu-latest
@@ -143,7 +168,22 @@ jobs:
143168
vp env doctor
144169
145170
export VITE_LOG=trace
146-
vp env run --node 24 -- node -p "process.versions"
171+
vp env run --node 24 -- node -p \"process.versions\"
172+
173+
# Test global package install
174+
npm install -g typescript
175+
tsc --version
176+
ls -la ~/.vite-plus/packages/typescript/
177+
ls -la ~/.vite-plus/bin/
178+
npm uninstall -g typescript
179+
echo \"Checking bin dir after uninstall:\"
180+
ls -la ~/.vite-plus/bin/
181+
if [ -f ~/.vite-plus/bin/tsc ]; then
182+
echo \"Error: tsc shim file still exists\"
183+
exit 1
184+
fi
185+
echo \"tsc shim removed successfully\"
186+
147187
# FIXME: qemu: uncaught target signal 11 (Segmentation fault) - core dumped
148188
# vp new create-vite --no-interactive --no-agent -- hello --no-interactive -t vanilla
149189
# cd hello && vp run build
@@ -202,3 +242,29 @@ jobs:
202242
$env:Path = "$env:USERPROFILE\.vite-plus\bin;$env:Path"
203243
vp env doctor
204244
vp env run --node 24 -- node -p "process.versions"
245+
246+
- name: Test global package install
247+
shell: pwsh
248+
run: |
249+
$env:Path = "$env:USERPROFILE\.vite-plus\bin;$env:Path"
250+
251+
# Test 1: Install a JS-based CLI (typescript)
252+
npm install -g typescript
253+
tsc --version
254+
255+
# Test 2: Verify the package was installed correctly
256+
Get-ChildItem "$env:USERPROFILE\.vite-plus\packages\typescript\"
257+
Get-ChildItem "$env:USERPROFILE\.vite-plus\bin\"
258+
259+
# Test 3: Uninstall
260+
npm uninstall -g typescript
261+
262+
# Test 4: Verify uninstall removed shim
263+
Write-Host "Checking bin dir after uninstall:"
264+
Get-ChildItem "$env:USERPROFILE\.vite-plus\bin\"
265+
$shimPath = "$env:USERPROFILE\.vite-plus\bin\tsc.cmd"
266+
if (Test-Path $shimPath) {
267+
Write-Error "tsc shim file still exists at $shimPath"
268+
exit 1
269+
}
270+
Write-Host "tsc shim removed successfully"

0 commit comments

Comments
 (0)