Hacktoberfest 2026: los issues que los mantenedores marcaron para octubre, abiertos y aptos para principiantes. Explorar issues de Hacktoberfest

Load feature-specific dependencies on first use

Abierto
#1,577 0 comentarios 0 reacciones 0 asignados Ver en GitHub

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

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

maintenance patch

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 (and ssh2, with its optional native cpu-features build) is needed only for TestContainers.exposeHostPorts.
  • undici is needed only for the HTTP wait strategy.
  • archiver is needed only when copying files into a container.
  • docker-compose is needed only for DockerComposeEnvironment.

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.ts
  • packages/testcontainers/src/wait-strategies/http-wait-strategy.ts
  • packages/testcontainers/src/generic-container/generic-container.ts and started-generic-container.ts
  • packages/testcontainers/src/container-runtime/clients/compose/

Notes

  • Runtime dependencies must keep loading from CommonJS (AGENTS.md).
  • ssh-remote-port-forward could become an optional dependency, which would also remove the native build step from installs that never expose host ports. That part would be major.
  • 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

Abrir en Codespaces

Inicia el contenedor de desarrollo del proyecto en tu navegador, con tu propia cuenta de GitHub.

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Más de testcontainers/testcontainers-node

Todos los issues de testcontainers/testcontainers-node

Issues similares

Más issues de TypeScript

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.