Files
tree-sitter-shellspec/.github/actions/test-coverage/action.yml
Ismo Vuorinen c8ba576b4e feat: implement complete tree-sitter-shellspec grammar with comprehensive testing
- Add full ShellSpec grammar extending tree-sitter-bash
- Support all ShellSpec constructs: Describe, Context, It, hooks, utilities
- Include Data block parsing with statements and argument styles
- Add 61 comprehensive test cases covering real-world patterns
- Implement optimized GitHub workflows with CI/CD automation
- Configure complete development tooling (linting, formatting, pre-commit)
- Add comprehensive documentation and contribution guidelines
- Optimize grammar conflicts to zero warnings
- Support editor integration for Neovim, VS Code, Emacs

Breaking Changes:
- Initial release, no previous API to break

BREAKING CHANGE: Initial implementation of tree-sitter-shellspec grammar

# Conflicts:
#	.github/workflows/codeql.yml
#	.github/workflows/pr-lint.yml
#	.pre-commit-config.yaml

# Conflicts:
#	.github/workflows/pr-lint.yml

# Conflicts:
#	.github/workflows/pr-lint.yml
2026-01-04 15:32:39 +02:00

72 lines
2.4 KiB
YAML

---
name: "Test Coverage Analysis"
description: "Analyzes test coverage and generates coverage report"
inputs:
minimum-tests:
description: "Minimum number of tests required"
required: false
default: "55"
outputs:
total-tests:
description: "Total number of tests found"
value: ${{ steps.coverage.outputs.total-tests }}
passing-tests:
description: "Number of passing tests"
value: ${{ steps.coverage.outputs.passing-tests }}
coverage-percent:
description: "Test coverage percentage"
value: ${{ steps.coverage.outputs.coverage-percent }}
runs:
using: "composite"
steps:
- name: Test Coverage Analysis
id: coverage
run: |
echo "## Test Coverage Report" > coverage_report.md
echo "" >> coverage_report.md
# Run tests and capture output
TEST_OUTPUT=$(npm test 2>&1)
TOTAL_TESTS=$(echo "$TEST_OUTPUT" | grep -E "^\s+[0-9]+\." | wc -l)
PASSING_TESTS=$(echo "$TEST_OUTPUT" | grep -E "^\s+[0-9]+\. ✓" | wc -l)
FAILING_TESTS=$(echo "$TEST_OUTPUT" | grep -E "^\s+[0-9]+\. ✗" | wc -l)
echo "- **Total Tests:** $TOTAL_TESTS" >> coverage_report.md
echo "- **Passing:** $PASSING_TESTS ✅" >> coverage_report.md
echo "- **Failing:** $FAILING_TESTS ❌" >> coverage_report.md
if [ $TOTAL_TESTS -gt 0 ]; then
COVERAGE_PERCENT=$(( (PASSING_TESTS * 100) / TOTAL_TESTS ))
echo "- **Coverage:** $COVERAGE_PERCENT%" >> coverage_report.md
else
COVERAGE_PERCENT=0
fi
echo "" >> coverage_report.md
echo "### Test Files" >> coverage_report.md
echo "$TEST_OUTPUT" | grep -E "^\s+[a-z_]+:" | sed 's/^/- /' >> coverage_report.md
cat coverage_report.md
# Set outputs
echo "total-tests=$TOTAL_TESTS" >> $GITHUB_OUTPUT
echo "passing-tests=$PASSING_TESTS" >> $GITHUB_OUTPUT
echo "coverage-percent=$COVERAGE_PERCENT" >> $GITHUB_OUTPUT
# Validate test coverage requirements
if [ $TOTAL_TESTS -lt ${{ inputs.minimum-tests }} ]; then
echo "❌ Expected at least ${{ inputs.minimum-tests }} tests, found $TOTAL_TESTS"
exit 1
fi
if [ $FAILING_TESTS -gt 0 ]; then
echo "❌ Found $FAILING_TESTS failing tests"
exit 1
fi
echo "✅ Test coverage is acceptable: $PASSING_TESTS/$TOTAL_TESTS tests passing ($COVERAGE_PERCENT%)"
shell: bash