fix(test): polyfill crypto before module load via vitest environmentO… #45
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: CI | |
| on: | |
| push: | |
| branches: [main, dev] | |
| pull_request: | |
| branches: [main] | |
| # Least-privilege permissions — satisfies CodeQL actions/missing-workflow-permissions (alert #5). | |
| # The job only needs to read the repository contents and upload artifacts; | |
| # no write access is required. | |
| permissions: | |
| contents: read | |
| jobs: | |
| test: | |
| name: Lint · Typecheck · Tests | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - name: Setup Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: 20 | |
| - name: Cache npm dependencies | |
| uses: actions/cache@v4 | |
| with: | |
| path: ~/.npm | |
| key: ${{ runner.os }}-node-${{ hashFiles('package.json') }} | |
| restore-keys: | | |
| ${{ runner.os }}-node- | |
| - name: Install dependencies | |
| run: npm install | |
| - name: Lint | |
| run: npx eslint src --max-warnings 0 | |
| - name: Typecheck | |
| run: npx tsc --noEmit | |
| - name: Run tests | |
| run: npm test | |
| - name: Upload coverage | |
| if: always() | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: coverage | |
| path: coverage/ | |
| retention-days: 14 | |
| if-no-files-found: ignore |