Skip to content

fix(repo): assign the E2E test server a dynamic port instead of 8010#229

Open
YusukeHirao wants to merge 2 commits into
devfrom
fix/162-test-server-dynamic-port
Open

fix(repo): assign the E2E test server a dynamic port instead of 8010#229
YusukeHirao wants to merge 2 commits into
devfrom
fix/162-test-server-dynamic-port

Conversation

@YusukeHirao

Copy link
Copy Markdown
Member

Summary

  • Fix test-server (E2E) to bind to an OS-assigned port instead of the fixed 8010, so concurrent git worktrees/sessions running yarn test / the E2E suite no longer collide with EADDRINUSE.
  • Thread the resolved port into the 7 routes that embed self-referencing "external" URLs via a lazily-read PortRef, and share it with test files through vitest's provide/inject channel (testServerPort).
  • Update 27 e2e test files and the report-google-sheets API test to read the dynamic port instead of hardcoding 8010, via a new test-server-port.ts helper (TEST_SERVER_PORT + origin constants).
  • Add server.spec.ts proving two concurrent startServer() calls get different ports — the behavior issue テスト用サーバーが固定ポート8010を専有し、並行worktree/セッション間で競合する #162 is actually about.
  • Update ARCHITECTURE.md / CLAUDE.md / the git skill doc to drop the stale fixed-port reference.

Closes #162

Test plan

  • yarn lint — 0 errors (41 pre-existing warnings, unrelated)
  • yarn test — 479 test files / 3372 tests passed (includes the new server.spec.ts)
  • yarn vitest run --config vitest.e2e.config.ts — 29 test files / 136 tests passed, confirmed running on a dynamically-assigned port (not 8010) in the log output
  • /code-review medium, /qa-engineer, /product-manager run — findings addressed (shared origin constants added, cross-reference comment for the duplicated ProvidedContext type augmentation, new concurrency-proving unit test)

Concurrent git worktrees/sessions running `yarn test` or the E2E suite
collided on the fixed port 8010 with EADDRINUSE, or blocked until the
earlier process released it.

- test-server: `startServer` now binds to an OS-assigned port (`port = 0`)
  and threads the resolved port into the 7 routes that embed
  self-referencing "external" URLs via a lazily-read `PortRef`
- global-setup.ts: shares the resolved port with test files through
  vitest's provide/inject channel (`testServerPort`)
- Add `test-server-port.ts` exporting `TEST_SERVER_PORT` and origin
  constants for building test URLs
- Update 27 e2e test files and the report-google-sheets API test to read
  the dynamic port instead of hardcoding 8010
- Add server.spec.ts proving two concurrent instances get different ports
- Update ARCHITECTURE.md/CLAUDE.md/git skill docs to drop the stale
  fixed-port reference

Closes #162
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

テスト用サーバーが固定ポート8010を専有し、並行worktree/セッション間で競合する

1 participant