nodejs / nodejs/node

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

Aperta Adatta ai principianti
#60,758 5 commenti 2 reazioni 0 assegnatari Vedi su GitHub

Nessuno ha ancora preso questa issue.

doc test_runner
Lingua principale
JavaScript
Stelle
122k
Fork
37.3k
Merge medio
4g 2h
PR unite (30g)
283

Descrizione

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.

Guida per i contributori

Apri la guida per i contributori

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Direzione di ricerca

Inizia dalla documentazione di Test Runner all’URL interessato, in particolare dalla sezione Subtests e dai relativi riferimenti alle suite. Confronta gli esempi di suite e nested test dell’issue, quindi documenta che cos’è una suite Node.js e in che modo il suo comportamento differisce da quello dei test con subtest; il lavoro è completato quando i lettori incontrano questa spiegazione prima della sezione Subtests.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Valutazione

Stack tecnologico
javascript
Ambito
documentation
Tipo di issue
Documentazione
Difficoltà
2/5
Tempo stimato
1-3 ore
Stato di attività
Tranquilla
Chiarezza
Abbastanza chiara
Idoneità per principianti
70/100

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.