Skip to content

Commit 7aa8d27

Browse files
committed
fix(ci): test failures should fail the build
The 'Check if tests exist' step was actually running tests with continue-on-error: true. If tests failed, it would set has-tests=false and skip the actual test step, making CI appear green even with failing tests. Changed to check if a test script exists in package.json without running it, and removed continue-on-error so test failures now properly fail the build. Fixes the issue where PR #3014 had failing tests but CI was green.
1 parent 0d0d2f8 commit 7aa8d27

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

.github/workflows/typescript.yml

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -45,12 +45,15 @@ jobs:
4545
id: check-tests
4646
working-directory: src/${{ matrix.package }}
4747
run: |
48-
if npm run test --silent 2>/dev/null; then
49-
echo "has-tests=true" >> $GITHUB_OUTPUT
48+
if grep -q '"test":' package.json; then
49+
if grep -q '"test": "echo \\"Error: no test specified\\" && exit 1"' package.json; then
50+
echo "has-tests=false" >> $GITHUB_OUTPUT
51+
else
52+
echo "has-tests=true" >> $GITHUB_OUTPUT
53+
fi
5054
else
5155
echo "has-tests=false" >> $GITHUB_OUTPUT
5256
fi
53-
continue-on-error: true
5457
5558
- name: Run tests
5659
if: steps.check-tests.outputs.has-tests == 'true'

0 commit comments

Comments
 (0)