Load feature-specific dependencies on first use
I maintainer di solito rispondono entro 1 giorno
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 4/5
- Tempo stimato
- 3-5 giorni
- Idoneità per principianti
- 58/100
- Tipo di issue
- Funzionalità
- Chiarezza
- Specificata chiaramente
- Stato di attività
- Attiva
- Stack tecnologico
- docker, node.js, typescript
- Ambito
- backend, performance
Direzione di ricerca
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.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
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.
- Lingua principale
- TypeScript
- Stelle
- 2.6k
- Fork
- 274
- Merge medio
- 1g 14h
- PR unite (30g)
- 44
Preparare l'ambiente
Avvia il container di sviluppo del progetto nel browser, con il tuo account GitHub.
- Include un Dockerfile o un file Docker Compose
- Nessun modello di pull request
- Leggi la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di testcontainers/testcontainers-node
-
enhancement minor
Difficoltà 2/5 1-3 ore Idoneità per principianti 74/100
testcontainers/testcontainers-node#1539 ·
I maintainer di solito rispondono entro 1 giorno
-
enhancement minor
Difficoltà 2/5 1-3 ore Idoneità per principianti 82/100
testcontainers/testcontainers-node#1533 ·
I maintainer di solito rispondono entro 1 giorno
-
enhancement minor
Difficoltà 2/5 1-3 ore Idoneità per principianti 77/100
testcontainers/testcontainers-node#1531 ·
I maintainer di solito rispondono entro 1 giorno
-
enhancement minor
Difficoltà 2/5 1-3 ore Idoneità per principianti 76/100
testcontainers/testcontainers-node#1529 ·
I maintainer di solito rispondono entro 1 giorno
-
enhancement minor
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
testcontainers/testcontainers-node#1528 ·
I maintainer di solito rispondono entro 1 giorno
Tutte le issue di testcontainers/testcontainers-node
Issue simili
-
bnv-manager-v2: accept_invite creates the Mailcow domain admin before the commitForse già presa @myOmikron l’ha presa oggi. Apertabug ready-for-agent
Difficoltà 2/5 1-3 ore Idoneità per principianti 82/100
-
Windows: mio 1.2.3 named-pipe use-after-free panics the native IPC broker and hangs every toolApertaplatform:windows tool triaged wontfix
Difficoltà 2/5 1-3 ore Idoneità per principianti 62/100
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 82/100
nicolettas-muggelbude/RechnungsFee#448 ·
I maintainer di solito rispondono entro 1 giorno
-
Android bug feature/error-tracking react-native team/error-tracking
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
PostHog/posthog-js#5310 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno