CI/CD error Error: connect ECONNREFUSED 127.0.0.1:3000
The test tried to hit a local server that isn't actually up yet in the CI environment, a classic 'works on my machine' parity gap.
Why this happens
- CI starts the test suite before the app/server has finished booting
- The app is bound to a different host/port in CI than the hardcoded one the test expects
How to fix it
- Use a start-and-wait tool (e.g. `start-server-and-test`, or a `webServer`/health-check option in your test runner's config) instead of a fixed sleep
- Read the target URL from an environment variable instead of hardcoding `localhost:3000`, so CI and local can differ safely