Load feature-specific dependencies on first use
Maintainer thường phản hồi trong vòng 1 ngày
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 4/5
- Thời gian dự kiến
- 3-5 ngày
- Mức phù hợp với người mới
- 58/100
- Loại issue
- Tính năng
- Độ rõ ràng
- Đặc tả rõ ràng
- Mức độ hoạt động
- Sôi nổi
- Công nghệ
- docker, node.js, typescript
- Lĩnh vực
- backend, performance
Hướng nghiên cứu
Read the four listed areas: port-forwarder.ts, http-wait-strategy.ts, the generic container files, and the compose clients directory. Check how port-generator.ts loads get-port and review AGENTS.md for the CommonJS requirement. Measure import time before and after; done means feature-specific dependencies load on first use and the measured saving justifies keeping the change.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
What happens
Importing testcontainers loads every dependency up front, including ones most test files never use. Measured with the local build of 12.2.0 on Node 24:
| Import | Time |
|---|---|
require("testcontainers"), warm |
about 165 ms |
require("testcontainers"), cold |
about 330 ms |
undici alone |
69 ms |
dockerode alone |
66 ms |
archiver alone |
57 ms |
ssh-remote-port-forward alone |
23 ms |
docker-compose alone |
15 ms |
The individual figures are from separate processes and overlap, so they do not add up.
ssh-remote-port-forward(andssh2, with its optional nativecpu-featuresbuild) is needed only forTestContainers.exposeHostPorts.undiciis needed only for the HTTP wait strategy.archiveris needed only when copying files into a container.docker-composeis needed only forDockerComposeEnvironment.
All four are imported statically. Test runners that isolate modules per test file pay the import once per file.
Expected
Feature-specific dependencies are loaded on first use. get-port is already loaded this way in port-generator.ts.
Where
packages/testcontainers/src/port-forwarder/port-forwarder.tspackages/testcontainers/src/wait-strategies/http-wait-strategy.tspackages/testcontainers/src/generic-container/generic-container.tsandstarted-generic-container.tspackages/testcontainers/src/container-runtime/clients/compose/
Notes
- Runtime dependencies must keep loading from CommonJS (AGENTS.md).
ssh-remote-port-forwardcould become an optional dependency, which would also remove the native build step from installs that never expose host ports. That part would bemajor.- Measure before and after. If the saving is small, close this.
Dependencies
- Nothing blocks this. It can start now.
- Ngôn ngữ chính
- TypeScript
- Star
- 2.6k
- Fork
- 277
- Merge trung bình
- 1 ngày 53 phút
- Pull request đã merge (30 ngày)
- 58
Chuẩn bị môi trường
Khởi chạy dev container của dự án ngay trên trình duyệt, bằng tài khoản GitHub của bạn.
- Có Dockerfile hoặc tệp Docker Compose
- Không có mẫu pull request
- Đọc hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của testcontainers/testcontainers-node
-
enhancement minor
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 74/100
testcontainers/testcontainers-node#1539 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
enhancement minor
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 82/100
testcontainers/testcontainers-node#1533 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
enhancement minor
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 77/100
testcontainers/testcontainers-node#1531 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
enhancement minor
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 76/100
testcontainers/testcontainers-node#1529 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
enhancement minor
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
testcontainers/testcontainers-node#1528 ·
Maintainer thường phản hồi trong vòng 1 ngày
Tất cả issue của testcontainers/testcontainers-node
Issue tương tự
-
area: image-engine bug priority: low
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 88/100
snapotter-hq/SnapOtter#3885 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Mend: dependency security vulnerability
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 68/100
Maintainer thường phản hồi trong vòng 3 ngày
-
pending triage
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 76/100
Maintainer thường phản hồi trong vòng 1 ngày
-
bug P3 UI/UX
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 68/100
Maintainer thường phản hồi trong vòng 1 ngày
-
clawsweeper:fix-shape-clear clawsweeper:queueable-fix clawsweeper:source-repro impact:ux-friction issue-rating: 🦞 diamond lobster no-stale P3
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 73/100
openclaw/openclaw#182077 · 1 bình luận · 1 reaction ·
Maintainer thường phản hồi trong vòng 1 ngày