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

Let a configured container be cloned and customised with functions

Abierto
#1,556 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
55/100
Tipo de issue
Nueva funcionalidad
Claridad
Bien especificado
Estado de actividad
Activo
Stack tecnológico
docker, node.js, typescript
Área
testing, tooling

Línea de trabajo

Start with the dependency, issue #1520, since this issue says clone() depends on its builder state being made copyable. Then read packages/testcontainers/src/generic-container/generic-container.ts and packages/testcontainers/src/test-container.ts to see how builder state and subclass state are handled. Done means clone() returns an independent builder of the same class and with(fn) applies a customizer in the chain; run the relevant tests in the test-container file.

Escrito por el modelo de indexación a partir del texto del issue.

Descripción

enhancement minor

What happens

A configured container cannot be used as a template. Builders are mutable and every with* method returns the same object:

const base = new GenericContainer(image).withEnvironment({ LOG_LEVEL: "debug" });
const a = base.withName("a");
const b = base.withName("b");
// a, b and base are one object, named "b"

Shared configuration therefore lives in factory functions, and a reusable piece of configuration has to be applied outside the chain:

const container = new PostgreSqlContainer(image).withDatabase("orders");
applyTracing(container);
await container.start();

Expected

  • clone() returns an independent copy of the builder, of the same class.
  • with(fn) applies a function inside the chain:
const withTracing = <T extends GenericContainer>(container: T) => container.withEnvironment({ OTEL_ENABLED: "true" });

await new PostgreSqlContainer(image).withDatabase("orders").with(withTracing).start();

Where

packages/testcontainers/src/generic-container/generic-container.ts and packages/testcontainers/src/test-container.ts.

Notes

  • Go models reusable configuration as ContainerCustomizer values passed to Run.
  • clone() needs the builder's state to be copyable in one place, including what subclasses add.

Dependencies

  • Blocked by #1520: clone() needs the builder state to be copyable, which is what that fix introduces.
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.