Spawned from the coverage analysis after the chat-sample sweep.
Hygiene refactor — no behavioural change, no new tests, no
removed tests.
The gap
tests/integration/ is referenced conceptually but empty:
tests/unit/ 164 test files
tests/integration/ 0 files
tests/multi-node/ ~14 test files (cluster, multi-process)
tests/smoke/ 1 file (cross-runtime smoke)
tests/util/ 3 helper files
The current convention is "everything that runs in-process under
Bun goes in tests/unit/", but several files already break that
contract — Cassandra/Sqlite tests touch real databases, the
broker tests spin up real Kafka/MQTT/Redis containers when
*_LIVE=1, the multi-node tests fork worker threads.
When we land #293 (multi-runtime CI), #296 (testcontainer broker
suites), and #297 (S3 LocalStack), we'll be adding many more
tests that legitimately don't belong in tests/unit/. Without
the split, tests/unit/ becomes a meaningless catch-all.
Scope
- Move from:
tests/unit/{cluster,persistence,io,...}/...
tests/multi-node/...
to:
tests/unit/ — pure in-process tests, no external services
tests/integration/ — multi-process, containers, real cloud SDK paths
- File moves only — no test-code edits. Suggested mapping:
tests/multi-node/** → tests/integration/cluster/
tests/unit/cluster/sharding/CassandraRememberEntitiesStore.test.ts → tests/integration/persistence/
tests/unit/persistence/CassandraJournal.test.ts → tests/integration/persistence/
tests/unit/persistence/CassandraTagIndex.test.ts → tests/integration/persistence/
tests/unit/io/broker/*Actor.test.ts (the ones with *_LIVE=1 opt-in containers) → tests/integration/io/
tests/unit/coordination/KubernetesLease.test.ts → tests/integration/coordination/
- Add separate
package.json scripts:
bun test tests/unit — fast path, runs in PR CI
bun test tests/integration — slow path, runs nightly or
on-demand
bun test — both (current behaviour)
- Update CI to run them in separate jobs so failures are
pre-attributed.
Acceptance criteria
Out of scope
- Renaming individual tests for clarity. This is purely the
directory split.
- Restructuring
tests/util/ — those are helpers, not tests.
Notes
This issue should land before #296 (broker testcontainers),
#297 (S3 LocalStack), and #298 (K8s providers) — those would
otherwise add 10+ new files into a directory whose semantics are
about to change.
Spawned from the coverage analysis after the chat-sample sweep.
Hygiene refactor — no behavioural change, no new tests, no
removed tests.
The gap
tests/integration/is referenced conceptually but empty:The current convention is "everything that runs in-process under
Bun goes in
tests/unit/", but several files already break thatcontract — Cassandra/Sqlite tests touch real databases, the
broker tests spin up real Kafka/MQTT/Redis containers when
*_LIVE=1, the multi-node tests fork worker threads.When we land #293 (multi-runtime CI), #296 (testcontainer broker
suites), and #297 (S3 LocalStack), we'll be adding many more
tests that legitimately don't belong in
tests/unit/. Withoutthe split,
tests/unit/becomes a meaningless catch-all.Scope
tests/multi-node/**→tests/integration/cluster/tests/unit/cluster/sharding/CassandraRememberEntitiesStore.test.ts→tests/integration/persistence/tests/unit/persistence/CassandraJournal.test.ts→tests/integration/persistence/tests/unit/persistence/CassandraTagIndex.test.ts→tests/integration/persistence/tests/unit/io/broker/*Actor.test.ts(the ones with*_LIVE=1opt-in containers) →tests/integration/io/tests/unit/coordination/KubernetesLease.test.ts→tests/integration/coordination/package.jsonscripts:bun test tests/unit— fast path, runs in PR CIbun test tests/integration— slow path, runs nightly oron-demand
bun test— both (current behaviour)pre-attributed.
Acceptance criteria
tests/integration/contains all tests that touch realexternal services, multi-process workers, or cross-runtime
I/O.
tests/unit/runs in < 30 s on a developer laptop.bun teststill runs both groups by default.relocated.
Out of scope
directory split.
tests/util/— those are helpers, not tests.Notes
This issue should land before #296 (broker testcontainers),
#297 (S3 LocalStack), and #298 (K8s providers) — those would
otherwise add 10+ new files into a directory whose semantics are
about to change.