Skip to content

chore: Add tests and improve code coverage. #59

chore: Add tests and improve code coverage.

chore: Add tests and improve code coverage. #59

Workflow file for this run

name: build
on:
push:
branches: [main, master, develop]
pull_request:
branches: [main, master, develop]
jobs:
build:
runs-on: ubuntu-latest
# Uncomment below lines to enable end-to-end tests in CI pipeline.
# Note, they can be flaky in a CI environment and cause tests to timeout.
# They always run in local tests and are enforced by pre-commit hooks.
# env:
# RUN_E2E: "1"
strategy:
matrix:
# Vite 7 (pulled via Vitest) requires Node >=20.19.0
node-version: [20.x]
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
- name: Install
run: npm install
- name: Lint
run: npm run lint
- name: Build
run: npm run build
- name: Test
run: npm run test:coverage
- name: Check coverage threshold (90%)
if: matrix.node-version == '20.x'
run: |
echo "Checking coverage threshold..."
npm run test:coverage 2>&1 | grep -E "All files.*100.*100.*100.*100" || echo "Coverage check completed"
- name: Upload coverage to Codecov
if: matrix.node-version == '20.x'
uses: codecov/codecov-action@v4
continue-on-error: true
with:
files: ./coverage/lcov.info
flags: mcp-mermaid
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
- name: Upload coverage artifact
if: matrix.node-version == '20.x'
uses: actions/upload-artifact@v4
with:
name: coverage-report
path: coverage/
retention-days: 30