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

Make wrapper to render configuration available at the global level

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

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

Đánh giá

Độ khó
4/5
Thời gian dự kiến
3-5 ngày
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
Đình trệ
Công nghệ
javascript, react
Lĩnh vực
frontend, testing

Hướng nghiên cứu

Bắt đầu bằng cách xác định API configure(...) hiện có và các điểm vào render(...), sau đó xem xét các test bao quát các tùy chọn render và hành vi cấu hình. Xác định cách wrapper được cấu hình toàn cục kết hợp với wrapper theo từng lần gọi hoặc bị wrapper theo từng lần gọi ghi đè, rồi thêm các test cho thấy wrapper toàn cục được áp dụng mà không làm hỏng cách sử dụng render hiện có.

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

Mô tả

enhancement needs investigation
Describe the feature you'd like:

When rendering components for test, I often find myself repeating render(ui, { wrapper: TestApp() }) over and over again.

It would be nice to have a possibility to define the wrapper using a global configure(...) call.

By having this in global config, you could ensure that, by default, all the rendered components are tested in the context resembling the onion structure of various wrappers and context providers that they are going to be embedded in in production code anyway. This would help capture bugs when this context layer has an adverse effect on the behaviour of the component under test.

Describe alternatives you've considered:

You could of course define a custom function that does the same for you by wrapping the call to render. However, without the hindsight of defining one upfront, if you've already used the barebones render in hundreds of tests before the need for a wrapper, you need to now refactor all of those tests :(

Teachability, Documentation, Adoption, Migration Strategy:

No migration needed as this would be backwards-compatible in terms of the configure API.

Ngôn ngữ chính
JavaScript
Star
19.7k
Fork
1.2k
Chỉ số merge pull request
Không có pull request nào được merge trong 30 ngày

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

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 testing-library/react-testing-library

Tất cả issue của testing-library/react-testing-library

Issue tương tự

Thêm issue về JavaScript

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.