Debugged coverage not working with Firefox

This commit is contained in:
LosEvons
2025-11-20 12:10:06 +00:00
parent 458ff4e0a0
commit de9334d8db
3 changed files with 27 additions and 0 deletions
+1
View File
@@ -48,6 +48,7 @@ services:
- .:/host:Z - .:/host:Z
ports: ports:
- "3000:3000" - "3000:3000"
- "51204:51204"
command: > command: >
sh -c "apt update && apt install -y wget postgresql-client && 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 && wget https://github.com/peterldowns/pgmigrate/releases/download/v0.0.6%2Bcommit.4f90829/pgmigrate-linux-amd64 -O /usr/local/bin/pgmigrate &&
+25
View File
@@ -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. 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).
+1
View File
@@ -11,6 +11,7 @@
"test": "vitest --disable-console-intercept", "test": "vitest --disable-console-intercept",
"test:coverage": "vitest --disable-console-intercept --coverage.enabled=true", "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": "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": "NODE_ENV=test playwright test",
"test:e2e:ui": "NODE_ENV=test playwright test --ui", "test:e2e:ui": "NODE_ENV=test playwright test --ui",
"test:e2e:debug": "NODE_ENV=test playwright test --debug" "test:e2e:debug": "NODE_ENV=test playwright test --debug"