mirror of
https://github.com/pnpm/action-setup.git
synced 2026-04-05 20:20:48 +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
|
run: which pnpm; which pnpx
|
||||||
|
|
||||||
- name: 'Test: version'
|
- 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'
|
- name: 'Test: install in a fresh project'
|
||||||
run: |
|
run: |
|
||||||
@@ -71,7 +78,14 @@ jobs:
|
|||||||
run: which pnpm && which pnpx
|
run: which pnpm && which pnpx
|
||||||
|
|
||||||
- name: 'Test: version'
|
- 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:
|
test_standalone:
|
||||||
name: Test with standalone
|
name: Test with standalone
|
||||||
@@ -98,7 +112,14 @@ jobs:
|
|||||||
run: which pnpm
|
run: which pnpm
|
||||||
|
|
||||||
- name: 'Test: version'
|
- 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'
|
- name: 'Test: install in a fresh project'
|
||||||
run: |
|
run: |
|
||||||
@@ -196,4 +217,11 @@ jobs:
|
|||||||
run: which pnpm; which pnpx
|
run: which pnpm; which pnpx
|
||||||
|
|
||||||
- name: 'Test: version'
|
- 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