File tree Expand file tree Collapse file tree 2 files changed +51
-5
lines changed
Expand file tree Collapse file tree 2 files changed +51
-5
lines changed Original file line number Diff line number Diff line change 2727 working-directory : ./test-project
2828 run : npm install
2929
30- - name : Run all tests
31- run : npm test
30+ - name : Run Jest tests
31+ run : npm test
32+
33+ # Test the actual GitHub Action
34+ - name : Test action - should find errors and fail
35+ id : test-fail
36+ uses : ./
37+ continue-on-error : true
38+ with :
39+ working-directory : ' ./test-project'
40+ fail-on-warnings : false
41+ fail-on-hints : false
42+
43+ - name : Verify action found errors
44+ run : |
45+ echo "Action outcome: ${{ steps.test-fail.outcome }}"
46+ echo "Errors found: ${{ steps.test-fail.outputs.errors }}"
47+ echo "Warnings found: ${{ steps.test-fail.outputs.warnings }}"
48+ echo "Hints found: ${{ steps.test-fail.outputs.hints }}"
49+
50+ if [ "${{ steps.test-fail.outcome }}" != "failure" ]; then
51+ echo "❌ Expected action to fail due to errors"
52+ exit 1
53+ fi
54+
55+ if [ "${{ steps.test-fail.outputs.errors }}" -eq "0" ]; then
56+ echo "❌ Expected to find TypeScript errors"
57+ exit 1
58+ fi
59+
60+ echo "✅ Action correctly failed with ${{ steps.test-fail.outputs.errors }} errors"
61+
62+ - name : Test action - should fail on warnings when enabled
63+ id : test-warnings
64+ uses : ./
65+ continue-on-error : true
66+ with :
67+ working-directory : ' ./test-project'
68+ fail-on-warnings : true
69+ fail-on-hints : false
70+
71+ - name : Verify action failed on warnings
72+ run : |
73+ if [ "${{ steps.test-warnings.outcome }}" != "failure" ]; then
74+ echo "❌ Expected action to fail on warnings"
75+ exit 1
76+ fi
77+ echo "✅ Action correctly failed when fail-on-warnings enabled"
Original file line number Diff line number Diff line change @@ -40,9 +40,9 @@ async function run(): Promise<void> {
4040
4141 core . info ( `svelte-check exit code: ${ exitCode } ` ) ;
4242
43- const errorCount = ( output . match ( / ^ E r r o r : / gm ) || [ ] ) . length ;
44- const warningCount = ( output . match ( / ^ W a r n i n g : / gm ) || [ ] ) . length ;
45- const hintCount = ( output . match ( / ^ H i n t : / gm ) || [ ] ) . length ;
43+ const errorCount = ( output . match ( / E r r o r : / g ) || [ ] ) . length ;
44+ const warningCount = ( output . match ( / W a r n i n g : / g ) || [ ] ) . length ;
45+ const hintCount = ( output . match ( / H i n t : / g ) || [ ] ) . length ;
4646
4747 core . setOutput ( 'errors' , errorCount . toString ( ) ) ;
4848 core . setOutput ( 'warnings' , warningCount . toString ( ) ) ;
You can’t perform that action at this time.
0 commit comments