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

未關閉 適合新手
#60,758 5 則留言 2 個 reaction 已指派 0 人 在 GitHub 檢視

還沒有人認領這個 Issue。

評估

難度
2/5
預估耗時
1-3 小時
新手友好度
70/100
Issue 類型
文件
描述清晰度
基本清楚
活躍度
冷清
技術堆疊
javascript
領域
documentation

研究方向

從受影響 URL 上的 Test Runner 文件開始,特別查看 Subtests 區段及其中對 suites 的參照。比較 issue 中的 suite 和 nested-test 範例,然後記錄 Node.js suite 是什麼,以及它的行為與帶有 subtests 的測試有何不同;完成的標準是讀者能在 Subtests 區段之前看到這項說明。

由索引模型根據 Issue 內容生成。

描述

doc test_runner
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.

主要語言
JavaScript
星號
122k
分支
37.4k
平均合併
4 天 3 小時
30 天內合併 PR
273

貢獻指南

開啟貢獻指南

從這裡開始

  1. 先讀完整個 Issue,再讀專案的貢獻指南。
  2. 在 Issue 下留言說明你要接手 —— 這能避免兩個人做同樣的事。
  3. Fork 儲存庫,在一個分支上完成修改。
  4. 送出 Pull Request,並在描述裡引用這個 Issue 編號。

nodejs/node 的其他 Issue

查看 nodejs/node 的全部 Issue

相似的 Issue

更多 JavaScript Issue

把新 issue 寄到你的電子郵件信箱

精選適合新手參與的 GitHub issue 摘要。