tests: narrow unit test/watch globs to tests/unit/test-*.mjs #4
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: Test Suite | |
| on: | |
| push: | |
| branches: [main, local_node_refactor] | |
| pull_request: | |
| branches: [main] | |
| jobs: | |
| test: | |
| runs-on: ubuntu-latest | |
| strategy: | |
| matrix: | |
| node-version: [18.x, 20.x] | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Setup Node.js ${{ matrix.node-version }} | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: ${{ matrix.node-version }} | |
| - name: Install dependencies | |
| run: npm install | |
| - name: Run unit tests | |
| run: npm run test:unit | |
| - name: Start server | |
| run: | | |
| npm start & | |
| echo $! > server.pid | |
| - name: Wait for server | |
| run: | | |
| for i in {1..30}; do | |
| if curl -s http://localhost:13331/api/health > /dev/null; then | |
| echo "Server is ready" | |
| exit 0 | |
| fi | |
| echo "Waiting for server... ($i/30)" | |
| sleep 2 | |
| done | |
| echo "Server failed to start" | |
| exit 1 | |
| - name: Run backend API tests | |
| run: npm run test:api | |
| - name: Run E2E tests | |
| run: HEADLESS=true npm run test:e2e | |
| - name: Upload screenshots | |
| if: always() | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: test-screenshots-node-${{ matrix.node-version }} | |
| path: tests/screenshots/ | |
| retention-days: 7 | |
| - name: Stop server | |
| if: always() | |
| run: | | |
| if [ -f server.pid ]; then | |
| kill $(cat server.pid) || true | |
| rm server.pid | |
| fi | |
| - name: Upload test results | |
| if: failure() | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: test-failures-node-${{ matrix.node-version }} | |
| path: | | |
| mtt-*.json | |
| tests/**/*.log | |
| retention-days: 7 |