Hacktoberfest 2026: những issue maintainer đã đánh dấu cho tháng Mười, đang mở và phù hợp người mới. Xem issue Hacktoberfest

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

Đang mở
#1,578 0 bình luận 0 reaction 0 người được giao Xem trên GitHub

Maintainer thường phản hồi trong vòng 1 ngày

Chưa có ai nhận issue này.

Đánh giá

Độ khó
5/5
Thời gian dự kiến
Hơn một tuần
Mức phù hợp với người mới
35/100
Loại issue
Tính năng
Độ rõ ràng
Khá rõ ràng
Mức độ hoạt động
Sôi nổi
Lĩnh vực
testing, tooling

Hướng nghiên cứu

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.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

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.
Ngôn ngữ chính
TypeScript
Star
2.6k
Fork
274
Merge trung bình
1 ngày 14 giờ
Pull request đã merge (30 ngày)
44

Chuẩn bị môi trường

Mở trong Codespaces

Khởi chạy dev container của dự án ngay trên trình duyệt, bằng tài khoản GitHub của bạn.

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của testcontainers/testcontainers-node

Tất cả issue của testcontainers/testcontainers-node

Issue tương tự

Thêm issue về TypeScript

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.