Repository navigation
Add the missing builder methods to the TestContainer interface - #1655
Merged
cristianrgreco merged 1 commit intoNov 19, 2026
Merged
cristianrgreco merged 1 commit into
cristianrgreco merged 1 commit into
Conversation
cristianrgreco
approved these changes
Nov 19, 2026
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.
Summary
GenericContainerhas five public builder methods that theTestContainerinterface does not declare:withName,withLabels,withNetworkAliases,withHealthCheckandwithIpcMode. Code typed againstTestContainer, such as the custom container example indocs/features/containers.md, could not call them. They are now declared on the interface with the same signatures.A type-level test in
test-container.test.tschecks that every publicwith*method onGenericContaineris declared onTestContainer, so the two can't drift apart again. Test files are compiled bynpm run check-compiles(theCompilejob), so a new builder method added only to the class fails CI with the missing names in the error.Verification
The check is enforced by
npm run check-compiles(theCompilejob).expectTypeOfdoes nothing at runtime, so the Vitest run passes either way.main,npm run check-compilesfails withTS2349 ... ExpectNever<"withHealthCheck" | "withIpcMode" | "withLabels" | "withName" | "withNetworkAliases">.npm run check-compiles(the package and all modules),npm run format,npm run lintandnpm run knippass.Not breaking (
minor)This only adds members to
TestContainer. Containers built onGenericContainer, which is how the docs say to write a custom container, already have these methods. Code that implementsTestContainerfrom scratch, or mocks it, would need to add the five methods, but that isn't a documented extension point, so I've kept theminorlabel from the issue. No docs change is needed: the custom container example is already typed asTestContainer, and its calls now type-check.Suggested labels:
enhancement,minor.Closes #1529