GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — doc: add test reporter event lifecycle diagram by sangwook-dev · Pull Request #63780 · nodejs/node

doc: add test reporter event lifecycle diagram #63780

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

Sign up for GitHub

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
sangwook-dev wants to merge 2 commits into nodejs:main from sangwook-dev:doc/test-reporter-events-lifecycle

Uh oh!

There was an error while loading. Please reload this page.

Closed

doc: add test reporter event lifecycle diagram #63780

Changes from all commits
Commits
Show all changes
2 commits
Select commit Hold shift + click to select a range
6763fea
doc: add test reporter event lifecycle diagram
sangwook-dev Jun 7, 2026
d460d29
doc: note test:interrupted in the lifecycle
sangwook-dev Aug 25, 2026
File filter
Filter by extension

Clear filters
Conversations
Failed to load comments.
Loading

Uh oh!

There was an error while loading. Please reload this page.

Jump to
Jump to file
Failed to load files.
Loading

Uh oh!

There was an error while loading. Please reload this page.

Diff view
Diff view

There are no files selected for viewing

68 changes: 68 additions & 0 deletions 68 doc/api/test.md
Show comments
View file
Open in desktop
Original file line number Diff line number Diff line change
Expand Up @@ -3578,6 +3578,74 @@ Global events are emitted once per test run:
The root test also emits [`'test:plan'`][] and [`'test:diagnostic'`][] events
at the end of the run to report run level totals.

### Event lifecycle

The tables above group the events; the diagram below places them on a
timeline. The declaration ordered events form the main spine, buffered so that
a reporter sees them in source order, while each execution ordered twin is
emitted immediately, when the work actually happens. In particular,
[`'test:start'`][] marks when a test begins _reporting_ its own and its
subtests' status, not when its body begins executing; that moment is
[`'test:dequeue'`][].

```text
node:test reporter event lifecycle
main spine = DECLARATION order (buffered; matches source order)
right side = EXECUTION order (emitted immediately); ◄ marks each twin

LEAF TEST
─────────
┌──────────────┐ test:enqueue
│ test:start │ ◄──── twins ──── (queued for execution;
└──────────────┘ type: 'suite' | 'test')
│ begins REPORTING test:dequeue
│ (not the start of (about to run; emitted right
│ the test body) before the test body runs)
│
│ [ between the twins, on the execution timeline, the test
│ body runs: context.log() emits test:log live, and
│ test:stdout / test:stderr stream with --test ]
│
▼
┌───────────────────────┐
│ test:pass │ test:fail │ ◄──── twin ──── test:complete
└───────────────────────┘ result (details.passed says which)
│
▼
test:diagnostic the test's own context.diagnostic() messages,
buffered while it runs, flushed after its result


SUITE / PARENT TEST (each subtest is the whole LEAF flow above)
───────────────────
test:start ─► [ full flow of each subtest ... ] ─►
test:plan (count = subtests) ─► test:pass │ test:fail ─►
test:diagnostic


RUN-LEVEL FINALE (root, after all top-level tests)
────────────────
test:plan top-level count
│
▼
test:diagnostic x N tests, suites, pass, fail, cancelled,
│ skipped, todo, duration_ms (+ coverage errors)
▼
test:coverage only if coverage is enabled
│
▼
test:summary ─► stream ends


INTERRUPTION (SIGINT, e.g. Ctrl+C, while tests are still running)
────────────
test:interrupted the innermost tests still running at that moment
│ (not emitted if none were running)
▼
the run exits immediately — the buffered spine never flushes, so
neither the finale above nor those tests' own results are emitted
```

### Event: `'test:coverage'`

* `data` {Object}
Expand Down
Loading
Oops, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

Add this suggestion to a batch that can be applied as a single commit. This suggestion is invalid because no changes were made to the code. Suggestions cannot be applied while the pull request is closed. Suggestions cannot be applied while viewing a subset of changes. Only one suggestion per line can be applied in a batch. Add this suggestion to a batch that can be applied as a single commit. Applying suggestions on deleted lines is not supported. You must change the existing code in this line in order to create a valid suggestion. Outdated suggestions cannot be applied. This suggestion has been applied or marked resolved. Suggestions cannot be applied from pending reviews. Suggestions cannot be applied on multi-line comments. Suggestions cannot be applied while the pull request is queued to merge. Suggestion cannot be applied right now. Please check back later.
You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.