From de9334d8dbd9f546f31b6933b88fb30739ac12db Mon Sep 17 00:00:00 2001 From: LosEvons Date: Thu, 20 Nov 2025 12:10:06 +0000 Subject: [PATCH] Debugged coverage not working with Firefox --- docker-compose.yml | 1 + gradesa/README.md | 25 +++++++++++++++++++++++++ gradesa/package.json | 1 + 3 files changed, 27 insertions(+) diff --git a/docker-compose.yml b/docker-compose.yml index 05b2b32..20fda0a 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -48,6 +48,7 @@ services: - .:/host:Z ports: - "3000:3000" + - "51204:51204" command: > sh -c "apt update && apt install -y wget postgresql-client && wget https://github.com/peterldowns/pgmigrate/releases/download/v0.0.6%2Bcommit.4f90829/pgmigrate-linux-amd64 -O /usr/local/bin/pgmigrate && diff --git a/gradesa/README.md b/gradesa/README.md index 63cea5f..a85181a 100644 --- a/gradesa/README.md +++ b/gradesa/README.md @@ -28,3 +28,28 @@ The easiest way to deploy your Next.js app is to use the [Vercel Platform](https Check out our [Next.js deployment documentation](https://nextjs.org/docs/app/building-your-application/deploying) for more details. ``` + +## Testing & Vitest UI + +This project uses Vitest for unit tests and V8 for coverage. Two helper scripts are provided: + +- `npm run test:coverage` — run tests with coverage in the terminal (no UI). +- `npm run test:coverage:ui` — start the Vitest UI bound to all interfaces so you can open the browser on your host: + + - Server: `http://localhost:51204/__vitest__/` + - Use this when accessing the UI from outside a container (port `51204` is forwarded in `docker-compose.yml`). + +- `npm run test:coverage:ui:localhost` — start the Vitest UI bound to `127.0.0.1`: + - Server: `http://127.0.0.1:51204/__vitest__/` + - Use this for local browser debugging (helps with Firefox connection issues). + +Notes & Troubleshooting + +- If the UI shows "Connecting…" in Firefox but works in Chrome: + - Try the `:localhost` script and open `http://127.0.0.1:51204`. + - Disable privacy extensions or open the UI in a Private Window. + - Clear site data / unregister service workers for that origin (DevTools → Application → Service Workers). + - Check the DevTools Console / Network tab for blocked WebSocket (ws://) connections. +- When running inside Docker/devcontainer: + - Ensure port `51204` is forwarded (the provided `docker-compose.yml` already maps `51204:51204`). + - If Vitest attempts to open a browser inside the container, use `--open=false` (already set in scripts). diff --git a/gradesa/package.json b/gradesa/package.json index 8328649..f96f67e 100644 --- a/gradesa/package.json +++ b/gradesa/package.json @@ -11,6 +11,7 @@ "test": "vitest --disable-console-intercept", "test:coverage": "vitest --disable-console-intercept --coverage.enabled=true", "test:coverage:ui": "vitest --ui --api.port=51204 --api.host=0.0.0.0 --open=false --disable-console-intercept --coverage.enabled=true", + "test:coverage:ui:localhost": "vitest --ui --api.port=51204 --api.host=127.0.0.1 --open=false --disable-console-intercept --coverage.enabled=true", "test:e2e": "NODE_ENV=test playwright test", "test:e2e:ui": "NODE_ENV=test playwright test --ui", "test:e2e:debug": "NODE_ENV=test playwright test --debug"