feat: improve test coverage, add benchmarks, and enhance error handling #100
Workflow file for this run
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: PR Checks | |
| on: | |
| pull_request: | |
| branches: [main] | |
| push: | |
| branches: [main] | |
| jobs: | |
| test: | |
| name: Test & Lint | |
| runs-on: ubuntu-latest | |
| strategy: | |
| matrix: | |
| node-version: [18, 20, 22] | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Setup pnpm | |
| uses: pnpm/action-setup@v4 | |
| - name: Setup Node.js ${{ matrix.node-version }} | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: ${{ matrix.node-version }} | |
| cache: 'pnpm' | |
| - name: Install dependencies | |
| run: pnpm install --frozen-lockfile | |
| - name: Type check | |
| run: pnpm run typecheck | |
| - name: Lint & format check | |
| run: pnpm run check | |
| - name: Build | |
| run: pnpm run build | |
| - name: Run tests | |
| run: pnpm run test | |
| - name: Run tests with coverage | |
| run: pnpm run test:coverage | |
| if: matrix.node-version == 20 | |
| - name: Verify coverage thresholds | |
| run: | | |
| echo "Coverage thresholds are enforced in vitest.config.ts:" | |
| echo " - Statements: 90%" | |
| echo " - Branches: 85%" | |
| echo " - Functions: 90%" | |
| echo " - Lines: 90%" | |
| echo "Test will fail if thresholds are not met." | |
| if: matrix.node-version == 20 | |
| - name: Upload coverage reports to Codecov | |
| uses: codecov/codecov-action@v5 | |
| if: matrix.node-version == 20 | |
| with: | |
| token: ${{ secrets.CODECOV_TOKEN }} |