Load feature-specific dependencies on first use
Los mantenedores suelen responder en 1 día
Nadie ha tomado este issue todavía.
Evaluación
- Dificultad
- 4/5
- Tiempo estimado
- 3-5 días
- Aptitud para principiantes
- 58/100
- Tipo de issue
- Nueva funcionalidad
- Claridad
- Bien especificado
- Estado de actividad
- Activo
- Stack tecnológico
- docker, node.js, typescript
- Área
- backend, performance
Línea de trabajo
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.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
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.
- Lenguaje dominante
- TypeScript
- Estrellas
- 2.6k
- Forks
- 274
- Merge medio
- 1 d 14 h
- PR fusionados (30 d)
- 44
Preparar el entorno
Inicia el contenedor de desarrollo del proyecto en tu navegador, con tu propia cuenta de GitHub.
- Incluye un Dockerfile o un archivo de Docker Compose
- Sin plantilla de pull request
- Leer la guía de contribución
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Más de testcontainers/testcontainers-node
-
enhancement minor
Dificultad 2/5 1-3 horas Aptitud para principiantes 74/100
testcontainers/testcontainers-node#1539 ·
Los mantenedores suelen responder en 1 día
-
enhancement minor
Dificultad 2/5 1-3 horas Aptitud para principiantes 82/100
testcontainers/testcontainers-node#1533 ·
Los mantenedores suelen responder en 1 día
-
enhancement minor
Dificultad 2/5 1-3 horas Aptitud para principiantes 77/100
testcontainers/testcontainers-node#1531 ·
Los mantenedores suelen responder en 1 día
-
enhancement minor
Dificultad 2/5 1-3 horas Aptitud para principiantes 76/100
testcontainers/testcontainers-node#1529 ·
Los mantenedores suelen responder en 1 día
-
enhancement minor
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
testcontainers/testcontainers-node#1528 ·
Los mantenedores suelen responder en 1 día
Todos los issues de testcontainers/testcontainers-node
Issues similares
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 72/100
Los mantenedores suelen responder en 1 día
-
needs triage
Dificultad 2/5 1-3 horas Aptitud para principiantes 76/100
homarr-labs/homarr#7191 ·
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 62/100
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 74/100
AvaProtocol/ava-sdk-js#276 ·
Los mantenedores suelen responder en 1 día
-
useFragment does not require `variables` when the fragment's variables type has required fieldsAbierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 75/100
apollographql/apollo-client#13493 ·
Los mantenedores suelen responder en 1 día