Repository navigation
feat(unit): expose real implementations for dependency tokens - #1121
Merged
Merged
Conversation
Keep identity per token and metadata, allow explicit mock overrides, and diagnose cycles, conflicting implementations, and unreachable bindings. Preserve existing core constructor parameters and adapter interfaces.
Add expose(token, Implementation) for string, symbol, and typed class tokens. Preserve v4 implicit mocking and existing expose(Class) calls. Document identity, override precedence, construction boundaries, and the distinction from production container wiring.
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #1121 +/- ##
==========================================
+ Coverage 92.84% 93.26% +0.41%
==========================================
Files 27 29 +2
Lines 615 668 +53
Branches 105 118 +13
==========================================
+ Hits 571 623 +52
Misses 27 27
- Partials 17 18 +1
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
Infer implementation types from the token constructor without requiring the NoInfer builtin. Verify existing and new exposed dependency consumers with TypeScript 5.2.2 and declaration checking enabled.
omermorad
force-pushed
the
feat/v4-token-exposure
branch
from
November 9, 2026 14:39
3f7c66b to
4b49d2a
Compare
omermorad
marked this pull request as ready for review
November 9, 2026 14:42
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Sociable tests cannot currently construct real implementations behind string, symbol, or abstract-class dependency tokens. Add an explicit binding while retaining existing Unit v4 behavior:
Fixes #464. This is an additive Unit v4 feature.
Craig's original contribution
This continues @craig0990's proposal and implementation in #465. Commit
477ae5c4ports his original211ed87d181e4bba1ca00bd29371663648820c1fand preserves Craig Roberts's Git authorship and original author date, with the source commit recorded in the message. The author email uses Craig's public GitHub-linked identity, as verified on his earlier merged contribution #529, so GitHub attributes the commit to @craig0990. The port resolves conflicts against the current architecture and retains the existing array-based core contracts. Follow-up validation, abstract-token support, documentation, and packed-consumer coverage are separate commits.Behavior
.expose(Class)retains its existing behavior..expose(token, Implementation)constructs the supplied implementation for a string, symbol, abstract-class, or concrete-class token..mock(...).auto(),.impl(), and.final()declarations can replace individual occurrences and take precedence over exposure.unitRef.get()remains for mocks..compose()remains unsupported. This PR does not add fail-fast behavior or change defaults.The test supplies the binding explicitly. Suites does not inspect or verify the production container's registration, so tests must keep their chosen implementation aligned with production wiring when that is relevant.
Compatibility and release
Existing core array parameters, custom construction strategies, and DI/doubles adapter contracts are retained. Bindings use an optional resolver setting; new resolution results and constructor parameters are additive. No adapter package changes or manual version/changelog edits are included.
The repository's actual conventional-commit release preset recommends minor bumps for
@suites/core.unitand@suites/unitfrom this PR, with no breaking-change notes. Preserve the authored conventional commits when merging.Validation
skipLibCheck: false. The reviewer verified that the fixture fails against the previous declarations and passes with the correction.