Hacktoberfest 2026:メンテナが10月に向けて印を付けた、オープンで初心者向けの issue。 Hacktoberfest の issue を見る

Let a configured container be cloned and customised with functions

オープン
#1,556 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る

メンテナーはふだん 1 日以内に返信

まだ誰も着手していません。

評価

難易度
4/5
見積もり時間
3〜5日
初心者へのやさしさ
55/100
issue の種類
機能追加
明瞭さ
明確に書かれている
活発さ
活発
技術スタック
docker, node.js, typescript
領域
testing, tooling

調査の方向性

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.

索引モデルが issue の本文から書いたものです。

説明

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.
主要言語
TypeScript
スター
2.6k
フォーク
277
平均マージ
1日 53分
マージ済み PR(30日)
58

環境構築

Codespaces で開く

このプロジェクトの開発コンテナを、あなたの GitHub アカウントでブラウザ上に起動します。

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

testcontainers/testcontainers-node のほかの issue

testcontainers/testcontainers-node の issue をすべて見る

似ている issue

TypeScript の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。