Why
The configs and scripts under examples/ are TypeScript, but they are not part of the main tsconfig.json include list (deliberately — they have their own dependency graph as standalone projects), and no vitest spec imports them. A regression there will NOT fail CI.
Discovered while reviewing PR #10, which migrated examples/02-retry-dlq/rabbitmq.config.ts from a raw options.arguments workaround to the typed deadLetter field. The migration is correct, but its correctness is not enforced anywhere — if a future change in src/types.ts makes RabbitMQConfig stricter, or a careless edit to the example introduces a typo, CI will stay green and the example will break for users who clone the repo and run pnpm exec tsx.
Scope
Just the config objects at first — they're the highest-signal artefact and the cheapest to test statically. The Producer/Consumer/Worker scripts (producer.ts, consumer.ts, worker.ts, dlq-drain.ts) execute side effects on import (top-level await producer.initialize() etc.), so they need different handling (mocked amqplib, or run-as-process).
Acceptance criteria
- A new vitest spec — e.g.
tests/examples.test.ts — statically imports each example's rabbitmq.config.ts:
examples/01-uniform-distribution/rabbitmq.config.ts
examples/02-retry-dlq/rabbitmq.config.ts
- For each: assert the import resolves and the exported
rabbitMQConfig satisfies a minimal structural check (e.g. expect(rabbitMQConfig.exchanges.length).toBeGreaterThan(0)).
- Optional but valuable: feed each config into
RabbitMQBase's queue/exchange setup against a makeFakeChannel() to assert the topology calls land as expected — turns the example into a tiny integration smoke test against the library API.
- No changes required to the example files themselves; this is read-only test coverage.
Out of scope
- Running the worker / consumer / producer scripts in tests (they perform real broker calls via top-level await). That's a separate "example integration test" effort, gated on a
RABBITMQ_URL env flag and probably a GitHub Actions service container — too much for this issue.
- Adding
package.json to each example folder (separate item, tracked under Track 2 follow-ups in PROJECT-BRIEF.md).
Effort
Small. ~20 lines of test code; touches only tests/. Could land alongside one of the remaining Phase 1 PRs as a 10-minute extra.
Surfaced in PR #10 review.
Why
The configs and scripts under
examples/are TypeScript, but they are not part of the maintsconfig.jsoninclude list (deliberately — they have their own dependency graph as standalone projects), and no vitest spec imports them. A regression there will NOT fail CI.Discovered while reviewing PR #10, which migrated
examples/02-retry-dlq/rabbitmq.config.tsfrom a rawoptions.argumentsworkaround to the typeddeadLetterfield. The migration is correct, but its correctness is not enforced anywhere — if a future change insrc/types.tsmakesRabbitMQConfigstricter, or a careless edit to the example introduces a typo, CI will stay green and the example will break for users who clone the repo and runpnpm exec tsx.Scope
Just the config objects at first — they're the highest-signal artefact and the cheapest to test statically. The Producer/Consumer/Worker scripts (
producer.ts,consumer.ts,worker.ts,dlq-drain.ts) execute side effects on import (top-levelawait producer.initialize()etc.), so they need different handling (mockedamqplib, or run-as-process).Acceptance criteria
tests/examples.test.ts— statically imports each example'srabbitmq.config.ts:examples/01-uniform-distribution/rabbitmq.config.tsexamples/02-retry-dlq/rabbitmq.config.tsrabbitMQConfigsatisfies a minimal structural check (e.g.expect(rabbitMQConfig.exchanges.length).toBeGreaterThan(0)).RabbitMQBase's queue/exchange setup against amakeFakeChannel()to assert the topology calls land as expected — turns the example into a tiny integration smoke test against the library API.Out of scope
RABBITMQ_URLenv flag and probably a GitHub Actions service container — too much for this issue.package.jsonto each example folder (separate item, tracked under Track 2 follow-ups inPROJECT-BRIEF.md).Effort
Small. ~20 lines of test code; touches only
tests/. Could land alongside one of the remaining Phase 1 PRs as a 10-minute extra.Surfaced in PR #10 review.