nodejs / nodejs/node

Test Runner docs could use more information on the concept of a Suite

Đang mở Phù hợp với người mới
#60,758 5 bình luận 2 reaction 0 người được giao Xem trên GitHub

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

doc test_runner
Ngôn ngữ chính
JavaScript
Star
122k
Fork
37.4k
Merge trung bình
4 ngày 3 giờ
Pull request đã merge (30 ngày)
272

Mô tả

Affected URL(s)

https://nodejs.org/docs/latest-v24.x/api/test.html

Description of the problem

The test runner docs could use more information regarding suites. Suites do behave subtly differently to a test with subtests. Documenting these difference is important.

For example, comparing and contrasting the difference in:

suite('s1', () => {
  test('t1', () => {
    assert.ok(true);
  });
  test('t2', () => {
    assert.ok(true);
  });
});

And then the equivalent:

test('s1', async (ctx) => {
  await ctx.test('t1', () => {
    assert.ok(true);
  });
  await ctx.test('t2', () => {
    assert.ok(true);
  });
});

I'm sure there is more details to mention too but this comparison stands out the most to me.

It also feels like the docs are missing this section because as you read the page top-to-bottom, you get to the Subtests section and it mentions:

This is necessary because tests do not wait for their subtests to complete, unlike tests created within suites.

Without ever actually introducing what a "suite" is.

I understand the concept of a "suite" is generally well understood in the context of a any test runner, but nonetheless the specifics for Node's version of it is important to detail as devs work to convert from other testing frameworks where they may be familiar with different assumptions for what a "suite" vs "test" is.

Hướng dẫn đóng góp

Mở hướng dẫn đóng góp

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.

Hướng nghiên cứu

Bắt đầu với tài liệu Test Runner tại URL bị ảnh hưởng, đặc biệt là phần Subtests và các tham chiếu đến suites trong đó. So sánh các ví dụ về suite và nested-test từ issue, sau đó ghi lại suite của Node.js là gì và hành vi của nó khác với các test có subtests như thế nào; được xem là hoàn thành khi người đọc gặp phần giải thích này trước phần Subtests.

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

Đánh giá

Công nghệ
javascript
Lĩnh vực
documentation
Loại issue
Tài liệu
Độ khó
2/5
Thời gian dự kiến
1-3 giờ
Mức độ hoạt động
Ít trao đổi
Độ rõ ràng
Khá rõ ràng
Mức phù hợp với người mới
70/100

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.