Hacktoberfest 2026: le issue che i maintainer hanno segnato per ottobre, aperte e adatte ai principianti. Sfoglia le issue Hacktoberfest

Ship test-runner helpers for Vitest, Jest and `node:test`

Aperta
#1,578 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
5/5
Tempo stimato
Più di una settimana
Idoneità per principianti
35/100
Tipo di issue
Funzionalità
Chiarezza
Abbastanza chiara
Stato di attività
Attiva
Stack tecnologico
javascript, node.js, typescript
Ambito
testing, tooling

Direzione di ricerca

Start by reading the global setup documentation and the existing package layouts under packages/, especially the Java and .NET test runner integrations mentioned in the issue. Then compare how Vitest, Jest, and node:test expose setup, lifecycle, and per-test context APIs. Done means optional packages provide the proposed container declaration and test helpers for all three runners, while respecting that global setup can pass only serialisable connection details.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

enhancement minor

What happens

Using a container from a test runner is wired by hand each time. The global setup page in the docs shows the pattern for one shared container:

  • a setup file that starts the container and stores it in a module variable
  • project.provide("redisUrl", ...) and inject("redisUrl") to pass a serialisable value to the tests
  • a teardown export that stops it
  • a config entry pointing at the setup file

Per-file and per-test containers need their own beforeAll/afterAll pairs or await using.

Expected

Small optional packages that turn this into a declaration, for example for Vitest:

// vitest.setup.ts
export default defineContainers({
  redis: () => new RedisContainer("redis:8"),
});

// some.test.ts
const test = withContainers<typeof containers>();
test("stores a value", async ({ redis }) => {
  /* redis.connectionUrl */
});

with equivalents for Jest and node:test.

Where

New packages under packages/, outside packages/testcontainers and packages/modules.

Notes

  • Java ships junit-jupiter and spock integration modules. .NET ships xUnit packages.
  • A global setup runs in a different process from the tests, so only serialisable connection details can cross. That shapes the API.
  • Independent of the core API work.

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

Apri in Codespaces

Avvia il container di sviluppo del progetto nel browser, con il tuo account GitHub.

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di testcontainers/testcontainers-node

Tutte le issue di testcontainers/testcontainers-node

Issue simili

Altre issue su TypeScript

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.