feat: add hidden assertion and improve test coverage #204
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 - TWD Tutorial Example CI tests | |
| on: | |
| push: | |
| branches: [ main ] | |
| pull_request: | |
| branches: [ main ] | |
| jobs: | |
| test: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v5 | |
| - name: Setup Node.js | |
| uses: actions/setup-node@v5 | |
| with: | |
| node-version: 24 | |
| - name: Install root dependencies | |
| run: npm ci | |
| - name: Build twd-js | |
| run: npm run build | |
| - name: Copy sw | |
| run: npm run copy:mock-sw | |
| - name: Copy dist files | |
| run: npm run copy:dist:tutorial-example | |
| - name: Install example app dependencies | |
| working-directory: examples/tutorial-example | |
| run: npm i | |
| - name: Start Vite dev server | |
| working-directory: examples/tutorial-example | |
| run: | | |
| echo "Starting Vite dev server..." | |
| npm run dev:ci > vite.log 2>&1 & | |
| VITE_PID=$! | |
| echo "Vite server starting with PID: $VITE_PID" | |
| echo "Waiting for server to be ready..." | |
| npx -y wait-on http://localhost:5173 --timeout 60000 --interval 1000 || (echo "Server failed to start" && cat vite.log && exit 1) | |
| echo "Vite server is ready" | |
| sleep 2 | |
| echo "Performing health check..." | |
| curl -f http://localhost:5173 > /dev/null || (echo "Server health check failed" && cat vite.log && exit 1) | |
| echo "Server health check passed" | |
| ps aux | grep -i vite | grep -v grep || echo "Warning: Vite process not found in process list" | |
| - name: Run Puppeteer tests (test:ci) | |
| working-directory: examples/tutorial-example | |
| run: npm run test:ci | |
| env: | |
| CI: true | |
| if: always() | |
| - name: Display Vite server logs (on failure) | |
| working-directory: examples/tutorial-example | |
| if: failure() | |
| run: | | |
| echo "=== Vite server logs ===" | |
| cat vite.log || echo "No vite.log found" | |
| echo "=== Checking if server is running ===" | |
| curl -v http://localhost:5173 || echo "Server is not responding" | |
| - name: Display coverage | |
| working-directory: examples/tutorial-example | |
| if: success() | |
| run: | | |
| npm run collect:coverage:text |