test: harden e2e infra, colocate helpers, and add tooling configs#63
Conversation
c56ed4d to
ef155ef
Compare
7159fcb to
136d8c7
Compare
ef155ef to
c5cc804
Compare
136d8c7 to
3b97b7b
Compare
1448c34 to
e1599e3
Compare
3b97b7b to
43a9f34
Compare
e1599e3 to
39f7c6f
Compare
43a9f34 to
f2cc487
Compare
39f7c6f to
22dcbcf
Compare
f2cc487 to
6b3844a
Compare
22dcbcf to
a662609
Compare
6b3844a to
0e4adaf
Compare
a662609 to
d8ac3fb
Compare
891752f to
be5ec70
Compare
d8ac3fb to
37eb8ca
Compare
|
Stack: e2e-stack Part of a stacked PR chain. Do not merge manually. |
37eb8ca to
8e483fd
Compare
be5ec70 to
efc8c54
Compare
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: ASSERTIVE Plan: Pro Run ID: 📒 Files selected for processing (49)
📝 WalkthroughWalkthroughThis pull request adds comprehensive development documentation, reorganizes test infrastructure, and enhances E2E test execution. New convention files define CLI command structure, error handling patterns, unit/integration testing practices, and E2E fixture setup. Test stub imports are consolidated under 🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. Comment |
efc8c54 to
e9be78f
Compare
8e483fd to
a920dbe
Compare
e9be78f to
978c82d
Compare
a920dbe to
2931d00
Compare
978c82d to
a32b0de
Compare
09185c0 to
2828a73
Compare
8e57e2f to
05a9a08
Compare
2828a73 to
5672569
Compare
05a9a08 to
5093deb
Compare
5672569 to
2a865ef
Compare
df785fa to
c720a34
Compare
2a865ef to
8f56478
Compare
c720a34 to
8e0811f
Compare
8f56478 to
d0f376d
Compare
8e0811f to
5a19141
Compare
93ae2f2 to
2574d9a
Compare
Move test/stubs.ts to test/lib/stubs.ts so it lives alongside other test helpers. Move test/lib/setup.ts to test/integration/lib/harness.ts so the integration test harness is colocated with the integration tests that use it. Update all import paths in unit and integration tests accordingly.
Add Claude rules for command authoring conventions, error handling patterns, and unit test conventions. Document CLERK_CLI_TOKEN non-interactive authentication in the auth command README. Update CLAUDE.md test command to exclude e2e tests by default.
2574d9a to
5132a8d
Compare
Two test files were merged into main on PR #59 after the colocation refactor was originally drafted, so they kept their pre-refactor import paths and broke unit tests on this branch: - commands/apps/list.test.ts referenced ../../test/stubs.ts - test/integration/completion.test.ts referenced ../lib/setup.ts Both now match the convention used by every other file in their respective directories.
- Remove unimplemented CLERK_CLI_TOKEN section from auth README - Error in refresh-e2e-fixtures when --only is missing a value (previously refreshed every fixture silently) - Align e2e test concurrency default to 4 across runner, package.json, and .claude/rules/e2e.md - Narrow testing rule to permit import-time mock.module() registration - Fix .claude/rules path globs to match packages/cli-core/src layout - Correct CI secret name and clarify production API targeting in e2e rules and CLAUDE.md - Fix bun test -> bun run test drift in CONTRIBUTING.md
getAvailablePort binds to port 0 and closes the listener before the dev server starts, leaving a TOCTOU window where a sibling fixture (or anything on the host) can grab the same port. At concurrency 4 this is a real collision risk. Move port allocation inside startDevServer and retry on conflict. A new internal tryStart helper watches dev server stdout/stderr for EADDRINUSE / "port X is in use" patterns and bails early instead of waiting the full 60s readiness timeout, then the outer loop picks a fresh port. Max 3 attempts before surfacing a bind failure. getAvailablePort is now module-private. The caller in fixture-test.ts reads the chosen port from the start result.
Configures weekly dependency updates for the root Bun workspace and the GitHub Actions used in CI. Fixture projects under test/e2e/fixtures/* are intentionally not listed: they are pinned snapshots of scaffolded framework output and are regenerated via `bun run e2e:refresh-fixtures`. Dependabot only checks the directories it is told about, so leaving them out means they will not receive update PRs.
Belt-and-suspenders defense. Dependabot does not auto-discover manifests, so the fixtures are already excluded by virtue of not being listed under `directory`. The new `exclude-paths` entry makes the intent explicit in the config and protects against future expansions of the configured paths (e.g. switching to `directories` with a glob).
Summary
This branch bundles four threads of work that grew out of the E2E test
infrastructure introduced in #59:
Test helper colocation
src/test/stubs.tstosrc/test/lib/stubs.tssrc/test/integration/lib/setup.tstosrc/test/integration/lib/harness.tsClaude rules and developer docs
.claude/rules/{commands,errors,testing,e2e}.mdcovering commandauthoring, error helpers, unit test conventions, and the full E2E flow
CONTRIBUTING.mddocumenting the local1Password-driven workflow (
bun run test:e2e:op)CLAUDE.mdand clarify that E2Etargets the production Clerk API with a dedicated test application
E2E test infrastructure hardening
scripts/refresh-e2e-fixtures.ts: error when--onlyis passed withouta value, instead of silently refreshing every fixture
scripts/run-e2e.ts: align default concurrency with the package scripttest/e2e/lib/dev-server.ts: resolve thegetAvailablePortTOCTOU raceby allocating the port inside
startDevServerand retrying onEADDRINUSE/ "port X is in use" output, with early-bail on conflictinstead of waiting the full 60s readiness timeout. Up to three attempts
before surfacing a hard failure.
Dependabot
.github/dependabot.ymlwith weeklybunandgithub-actionsupdates
test/e2e/fixtures/*are excluded both by notbeing listed as a configured
directoryand via an explicitexclude-pathsglob as a defensive backstop, since those fixtures arepinned snapshots regenerated by
bun run e2e:refresh-fixturesTest plan
bun run format:checkbun run lintbun run testbun run test:e2e:opexercises the port-conflict retry path underconcurrency 4
Summary by CodeRabbit
Tests
Reliability
Chores