Migrate tests to vitest and configure miniflare integration #949
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: Pull Request | |
| on: | |
| # Trigger the workflow on push or pull request, | |
| # but only for the main branch | |
| push: | |
| branches: | |
| - main | |
| pull_request: | |
| branches: | |
| - main | |
| jobs: | |
| checks: | |
| runs-on: ubuntu-latest | |
| strategy: | |
| matrix: | |
| include: | |
| - node-version: 18.x | |
| test-type: nodejs | |
| - node-version: 20.x | |
| test-type: nodejs | |
| - node-version: 22.x | |
| test-type: nodejs | |
| - node-version: 24.x | |
| test-type: nodejs | |
| - node-version: 20.x | |
| test-type: cloudflare-workers | |
| name: ${{ matrix.test-type == 'cloudflare-workers' && 'Cloudflare Workers' || format('Nodejs {0}', matrix.node-version) }} | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Setup Nodejs ${{ matrix.node-version }} | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: ${{ matrix.node-version }} | |
| - name: Install dependencies and build | |
| run: npm install | |
| - name: Run lint checks | |
| if: matrix.test-type == 'nodejs' | |
| run: npm run lint:ci | |
| - name: Run prettier checks | |
| if: matrix.test-type == 'nodejs' | |
| run: npm run lint:prettier:check | |
| - name: Run Node.js tests | |
| if: matrix.test-type == 'nodejs' | |
| run: npm run test:coverage | |
| - name: Run Cloudflare Workers tests | |
| if: matrix.test-type == 'cloudflare-workers' | |
| run: npm run test:miniflare | |
| - name: Upload coverage to Codecov | |
| uses: codecov/codecov-action@v4 | |
| with: | |
| token: ${{ secrets.CODECOV_TOKEN }} |