mirror of
https://github.com/pnpm/action-setup.git
synced 2026-04-03 19:00:10 +08:00
test: validate pnpm --version output in CI
All version checks now capture output and assert it matches a semver pattern. Previously, a silently failing pnpm (exit 0, no output) would pass the tests.
This commit is contained in:
36
.github/workflows/test.yaml
vendored
36
.github/workflows/test.yaml
vendored
@@ -33,7 +33,14 @@ jobs:
|
||||
run: which pnpm; which pnpx
|
||||
|
||||
- name: 'Test: version'
|
||||
run: pnpm --version
|
||||
run: |
|
||||
actual="$(pnpm --version)"
|
||||
echo "pnpm version: ${actual}"
|
||||
if [[ ! "${actual}" =~ ^[0-9]+\.[0-9]+\.[0-9]+ ]]; then
|
||||
echo "ERROR: pnpm --version did not produce valid output"
|
||||
exit 1
|
||||
fi
|
||||
shell: bash
|
||||
|
||||
- name: 'Test: install in a fresh project'
|
||||
run: |
|
||||
@@ -71,7 +78,14 @@ jobs:
|
||||
run: which pnpm && which pnpx
|
||||
|
||||
- name: 'Test: version'
|
||||
run: pnpm --version
|
||||
run: |
|
||||
actual="$(pnpm --version)"
|
||||
echo "pnpm version: ${actual}"
|
||||
if [[ ! "${actual}" =~ ^[0-9]+\.[0-9]+\.[0-9]+ ]]; then
|
||||
echo "ERROR: pnpm --version did not produce valid output"
|
||||
exit 1
|
||||
fi
|
||||
shell: bash
|
||||
|
||||
test_standalone:
|
||||
name: Test with standalone
|
||||
@@ -98,7 +112,14 @@ jobs:
|
||||
run: which pnpm
|
||||
|
||||
- name: 'Test: version'
|
||||
run: pnpm --version
|
||||
run: |
|
||||
actual="$(pnpm --version)"
|
||||
echo "pnpm version: ${actual}"
|
||||
if [[ ! "${actual}" =~ ^[0-9]+\.[0-9]+\.[0-9]+ ]]; then
|
||||
echo "ERROR: pnpm --version did not produce valid output"
|
||||
exit 1
|
||||
fi
|
||||
shell: bash
|
||||
|
||||
- name: 'Test: install in a fresh project'
|
||||
run: |
|
||||
@@ -196,4 +217,11 @@ jobs:
|
||||
run: which pnpm; which pnpx
|
||||
|
||||
- name: 'Test: version'
|
||||
run: pnpm --version
|
||||
run: |
|
||||
actual="$(pnpm --version)"
|
||||
echo "pnpm version: ${actual}"
|
||||
if [[ ! "${actual}" =~ ^[0-9]+\.[0-9]+\.[0-9]+ ]]; then
|
||||
echo "ERROR: pnpm --version did not produce valid output"
|
||||
exit 1
|
||||
fi
|
||||
shell: bash
|
||||
|
||||
Reference in New Issue
Block a user