A tool for people curious about the React Server Components protocol rscexplorer.dev/
rsc react

maybe fix tests

+9 -39
+1
.github/workflows/ci.yml
··· 16 16 node-version: 22 17 17 cache: npm 18 18 - run: npm install 19 + - run: npx playwright install --with-deps chromium 19 20 - run: npm test 20 21 - run: npm run build:versions
+2
.tangled/workflows/ci.yaml
··· 10 10 steps: 11 11 - name: install 12 12 command: npm install 13 + - name: install playwright 14 + command: npx playwright install --with-deps chromium 13 15 - name: test 14 16 command: npm test 15 17 - name: build versions
+1 -1
package.json
··· 10 10 "build:versions": "node scripts/build-version.js --all", 11 11 "dev": "vite", 12 12 "preview": "vite preview", 13 - "deploy": "npm install && npm test && npm run build:versions && wrangler pages deploy dist --project-name=rscexplorer", 13 + "deploy": "npm install && npm run lint && npm test && npm run build:versions && wrangler pages deploy dist --project-name=rscexplorer", 14 14 "test": "vitest run --reporter=verbose", 15 15 "lint": "eslint .", 16 16 "format": "prettier --write .",
-37
tests/globalSetup.js
··· 1 - import { spawn, execSync } from "child_process"; 2 - 3 - let devServer; 4 - 5 - export async function setup() { 6 - await new Promise((resolve, reject) => { 7 - devServer = spawn("npm", ["run", "dev", "--", "--port", "5599"], { 8 - stdio: ["ignore", "pipe", "pipe"], 9 - detached: false, 10 - }); 11 - 12 - devServer.stdout.on("data", (data) => { 13 - if (data.toString().includes("Local:")) { 14 - resolve(); 15 - } 16 - }); 17 - 18 - devServer.stderr.on("data", (data) => { 19 - console.error(data.toString()); 20 - }); 21 - 22 - devServer.on("error", reject); 23 - 24 - // Timeout after 30s 25 - setTimeout(() => reject(new Error("Dev server failed to start")), 30000); 26 - }); 27 - } 28 - 29 - export async function teardown() { 30 - if (devServer) { 31 - devServer.kill("SIGTERM"); 32 - // Also kill any process on the port 33 - try { 34 - execSync("lsof -ti:5599 | xargs kill -9 2>/dev/null || true"); 35 - } catch {} 36 - } 37 - }
+5 -1
vitest.config.js
··· 4 4 test: { 5 5 testTimeout: 15000, 6 6 fileParallelism: true, 7 - globalSetup: "./tests/globalSetup.js", 7 + webServer: { 8 + command: "npm run dev -- --port 5599", 9 + port: 5599, 10 + reuseExistingServer: !process.env.CI, 11 + }, 8 12 }, 9 13 });