nodejs / nodejs/node

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

Offen Anfängerfreundlich
#60,758 5 Kommentare 2 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen

Dieses Issue hat noch niemand übernommen.

doc test_runner
Vorherrschende Sprache
JavaScript
Sterne
122k
Forks
37.3k
Ø Merge
4 T. 2 Std.
Gemergte PRs (30 T.)
283

Beschreibung

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.

Beitragsleitfaden

Beitragsleitfaden öffnen

Erste Schritte

  1. Lies das ganze Issue und danach den Beitragsleitfaden des Projekts.
  2. Schreib ins Issue, dass du es übernimmst — das erspart doppelte Arbeit.
  3. Forke das Repository und arbeite in einem Branch.
  4. Öffne einen Pull Request, der die Issue-Nummer nennt.

Rechercherichtung

Beginne mit der Test Runner-Dokumentation unter der betroffenen URL, insbesondere mit dem Abschnitt Subtests und seinen Verweisen auf Suites. Vergleiche die Suite- und Nested-Test-Beispiele aus dem Issue und dokumentiere, was eine Node.js-Suite ist und wie sich ihr Verhalten von Tests mit Subtests unterscheidet; als erledigt gilt die Aufgabe, wenn Leser diese Erklärung vor dem Abschnitt Subtests vorfinden.

Vom Indexierungsmodell aus dem Issue-Text verfasst.

Bewertung

Tech-Stack
javascript
Bereich
documentation
Issue-Typ
Dokumentation
Schwierigkeit
2/5
Geschätzter Aufwand
1-3 Stunden
Aktivitätsstatus
Ruhig
Klarheit
Größtenteils klar
Anfängerfreundlichkeit
70/100

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.