Skip to content

test: use os-assigned ports for test servers#97

Merged
KyleJune merged 2 commits into
mainfrom
test/os-assigned-test-ports
Jul 18, 2026
Merged

test: use os-assigned ports for test servers#97
KyleJune merged 2 commits into
mainfrom
test/os-assigned-test-ports

Conversation

@KyleJune

Copy link
Copy Markdown
Member

Summary

Test servers no longer bind fixed port 8100, so multiple test runners (e.g. parallel AI agents) can run simultaneously without "address already in use" failures. Note that leaving DENO_SERVE_ADDRESS unset is not an option: Deno.serve then defaults to fixed port 8000, which would collide with the dev server instead.

Changes

  • Spawn-style main.test.ts tests (example, 4 templates, blog tutorial) now inject DENO_SERVE_ADDRESS=tcp:127.0.0.1:0 into the spawned child so the OS assigns a free port, parse the actual URL from the child's Listening on line, and fetch that URL instead of a hardcoded http://localhost:8100/. The Windows-specific exact-line assertion existed only to check the fixed port and is removed.
  • Removed DENO_SERVE_ADDRESS from all .env.test files.
  • Synced docs: docs/getting-started.md, docs/tutorials/blog.md (embedded test snippet matches the real file), template/example/tutorial READMEs, and the stale port example in src/utils/global-jsdom.ts (its 8000 fallback behavior is unchanged).

Testing

All project suites pass: src (19 tests / 266 steps), example, all 4 templates, and the blog tutorial. Parallel-safety was proven directly: two concurrent runs of the same spawn test bound different OS-assigned ports (42695 / 34611) and both passed; nothing is left listening on 8100 afterward.

🤖 Generated with Claude Code

KyleJune and others added 2 commits July 17, 2026 20:10
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@KyleJune

Copy link
Copy Markdown
Member Author

docs: recommend dot reporter for test runs — AGENTS.md Testing section now says to use --reporter=dot when running all tests or any run that doesn't need a test's console output (detail printed only for failures); drop it only when debugging with logs. Companion to udibo/udibo#59.

@KyleJune
KyleJune merged commit 9f89511 into main Jul 18, 2026
10 checks passed
@KyleJune
KyleJune deleted the test/os-assigned-test-ports branch July 18, 2026 00:17
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.

1 participant