Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 22 additions & 0 deletions proposals/doc - standardize it and describe usage in examples.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
## Problem

We noticed that in the test runner documentation the `it()` and `describe()` aliases are introduced after they are already used in the *“Expecting tests to fail”* example. This makes the reading flow confusing for first-time readers.

This ordering issue is addressed by the following PR:
https://github.com/nodejs/node/pull/61567

While working on this, we also noticed a broader issue: there is no clear rationale for when examples use `test()` versus `it()` / `describe()`. As a result, the examples across the documentation are not fully consistent.

In particular, clarity would improve by keeping all flag-based options for `test()` together (`skip`, `todo`, `expectFailure`, `only`) and using a consistent style in those examples.

## Proposed solutions

### Option 1: Use `test()` for flag-based examples

Change the `expectFailure` example to use `test()` instead of `it()`.
This keeps it consistent with the `skip` and `todo` examples and makes the documentation easier to learn.

### Option 2: Introduce `it()` / `describe()` earlier

If `it()` and `describe()` are considered common enough that readers should get used to them early, move the aliases section to the top of the document.
After that, examples for other features can use either `test()` or `it()`.