Skip to content

Implement alternative editor panel with penpal bridge #75

Implement alternative editor panel with penpal bridge

Implement alternative editor panel with penpal bridge #75

name: Jest Tests
on:
pull_request:
branches: [ main ]
jobs:
test:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: 20.x
cache: 'npm'
- name: Install dependencies
run: npm ci
- name: Lint code
run: npx eslint components/ui/ui-builder/ lib/ --max-warnings 0
- name: Type check
run: npx tsc --noEmit
- name: Run tests with coverage
run: npm run test -- --coverage --coverageReporters=text-summary --coverageReporters=lcov
- name: Check coverage threshold
run: |
# Extract coverage percentage from the test output
COVERAGE=$(npm run test -- --coverage --coverageReporters=text-summary --silent | grep -o 'Lines.*: [0-9.]*%' | grep -o '[0-9.]*' | head -1)
echo "Current line coverage: ${COVERAGE}%"
# Check if coverage is below 90%
if (( $(echo "$COVERAGE < 90" | bc -l) )); then
echo "❌ Coverage ($COVERAGE%) is below the required threshold of 90%"
exit 1
else
echo "✅ Coverage ($COVERAGE%) meets the required threshold of 90%"
fi