Separate module-author internals from the user-facing entry point
维护者通常 1 天内回复
还没有人认领这个 Issue。
评估
- 难度
- 5/5
- 预计耗时
- 一周以上
- 新手友好度
- 35/100
- Issue 类型
- 重构
- 描述清晰度
- 基本清楚
- 活跃度
- 活跃
- 技术栈
- docker, node.js, typescript
调研方向
Start with packages/testcontainers/src/index.ts, packages/testcontainers/package.json, and biome.json; review the imports used by the five named modules and the blockers #1558 and #1561, plus coordination issues #1528 and #1550. Define the test-author exports, the module subpath, and the deep-import boundary, then check that module imports and public Dockerode type exposure match the agreed split.
由索引模型根据 Issue 内容生成。
描述
What happens
testcontainers has a single entry point (main: build/index.js, no exports map) that serves both test authors and module authors. Utilities that exist for the modules and for core itself are exported next to the user-facing API, and every one of them is covered by semver:
log,IntervalRetry,RetryUuid,RandomUuid,randomUuidPortGenerator,RandomPortGeneratorBoundPorts,getContainerPort,hasHostBindinggetReaper,LABEL_TESTCONTAINERS_SESSION_IDContainerRuntimeClient,getContainerRuntimeClient,waitForContainer
Dockerode types are part of the public contract as well:
WaitStrategy.waitUntilReady(container: Dockerode.Container, ...)StartupCheckStrategy.checkStartupState(dockerClient: Dockerode, ...)- the protected
createOpts: ContainerCreateOptionsandhostConfig: HostConfigonGenericContainer, which subclasses read and write directly
That is why @types/dockerode is a runtime dependency, and why a Dockerode major is a breaking change here.
Because there is no exports map, consumers can also import anything under testcontainers/build/....
Usage inside this repo is narrow. Most modules import only GenericContainer, AbstractStartedContainer, Wait and StartedTestContainer. Five of them (kafka, redpanda, localstack, ollama, couchbase) reach for the runtime client, BoundPorts, waitForContainer or getReaper.
Expected
- The main entry exports what a test author needs.
- Module-author utilities move to a separate subpath (for example
testcontainers/module) with its own, looser stability promise. - An
exportsmap closes off deep imports. - Dockerode types stay out of the user-facing signatures where possible.
Where
packages/testcontainers/src/index.tspackages/testcontainers/package.jsonbiome.json(the import boundary rule that pins modules to thetestcontainersentry point)
Notes
- Removing exports and adding an
exportsmap are both breaking, hencemajor. - Related: #1528 (types that should be exported but are not).
- Go keeps this split with
internal/packages.
Dependencies
- Blocked by #1558: that removes
Dockerode.ContainerandBoundPortsfrom the wait strategy interface, which decides what is left to move. - Blocked by #1561: that removes the
Uuidexports outright. - Coordinate with #1528: both edit
index.ts. - Coordinate with #1550: an escape hatch is the alternative to subclasses reaching into the protected fields.
- 主要语言
- TypeScript
- 星标
- 2.6k
- 派生
- 274
- 平均合并
- 1 天 14 小时
- 30 天内合并 PR
- 44
环境准备
在浏览器里用你自己的 GitHub 账号启动这个项目的开发容器。
- 提供 Dockerfile 或 Docker Compose 文件
- 没有 Pull Request 模板
- 阅读贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
testcontainers/testcontainers-node 的其他 Issue
-
enhancement minor
难度 2/5 1-3 小时 新手友好度 74/100
testcontainers/testcontainers-node#1539 ·
维护者通常 1 天内回复
-
enhancement minor
难度 2/5 1-3 小时 新手友好度 82/100
testcontainers/testcontainers-node#1533 ·
维护者通常 1 天内回复
-
enhancement minor
难度 2/5 1-3 小时 新手友好度 77/100
testcontainers/testcontainers-node#1531 ·
维护者通常 1 天内回复
-
enhancement minor
难度 2/5 1-3 小时 新手友好度 76/100
testcontainers/testcontainers-node#1529 ·
维护者通常 1 天内回复
-
enhancement minor
难度 2/5 1-3 小时 新手友好度 78/100
testcontainers/testcontainers-node#1528 ·
维护者通常 1 天内回复
查看 testcontainers/testcontainers-node 的全部 Issue
相似的 Issue
-
bug
难度 2/5 1-3 小时 新手友好度 80/100
aws/agentcore-cli#2606 ·
维护者通常 1 天内回复
-
ai-driven-qa bug Cosmetic
难度 2/5 1-3 小时 新手友好度 74/100
维护者通常 1 天内回复
-
ai-driven-qa bug claude Minor
难度 2/5 1-3 小时 新手友好度 64/100
linagora/twake-mail-admin#301 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 75/100
维护者通常 1 天内回复
-
reproduced
难度 2/5 1-3 小时 新手友好度 70/100
anomalyco/opencode#56038 · 1 条评论 ·
维护者通常 1 天内回复