Skip to content

test_runner: add kind to test:diagnostic events - #68026

Open
ShogunPanda wants to merge 1 commit into
nodejs:mainfrom
ShogunPanda:reporter-event-kind
Open

ShogunPanda wants to merge 1 commit into
nodejs:mainfrom
ShogunPanda:reporter-event-kind

Conversation

@ShogunPanda

Copy link
Copy Markdown
Contributor

Summary

With process isolation, the test runner silently drops user diagnostics that look like one of the run level totals. For example, t.diagnostic('pass 42') in a top-level test is never reported, while it is reported with --test-isolation=none.

Each child process reports its own totals as plain test:diagnostic events, and the parent recognized them by matching the message text. This PR adds a kind property to test:diagnostic events, set to 'summary' for the run level totals, and makes the parent filter on it instead.

Changes

  • test:diagnostic events now have a kind property. It is 'summary' for the totals reported by the root test and undefined otherwise.
  • The parent process drops the per-file totals based on kind rather than on the message, so user diagnostics are always reported.
  • Custom reporters can use kind to recognize the totals without parsing the message.
  • The new property is documented, and a test covers both isolation modes.

Notes

Additional Informations

AI-assisted work. All changes reviewed by a human.

@nodejs-github-bot

Copy link
Copy Markdown
Collaborator

Review requested:

  • @nodejs/test_runner

@nodejs-github-bot nodejs-github-bot added needs-ci PRs that need a full CI run. test_runner Issues and PRs related to the test runner subsystem. labels Dec 5, 2026
When using process isolation, the parent process recognized the run
level totals reported by each child by matching the text of the
diagnostic messages. User diagnostics with the same shape, such as
`pass 42`, were silently dropped.

Add a `kind` property to `test:diagnostic` events, set to `'summary'`
for the run level totals, and use it to filter them instead.

Refs: nodejs#46441
Signed-off-by: Paolo Insogna <paolo@cowtech.it>
@codecov

codecov Bot commented Dec 5, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 90.59%. Comparing base (c67d87c) to head (7c3cdd1).

Additional details and impacted files
@@            Coverage Diff             @@
##             main   #68026      +/-   ##
==========================================
+ Coverage   90.58%   90.59%   +0.01%     
==========================================
  Files         802      802              
  Lines      287050   287043       -7     
  Branches    55431    55431              
==========================================
+ Hits       260013   260042      +29     
+ Misses      17131    17085      -46     
- Partials     9906     9916      +10     
Files with missing lines Coverage Δ
lib/internal/test_runner/runner.js 95.15% <100.00%> (-0.04%) ⬇️
lib/internal/test_runner/test.js 97.95% <100.00%> (ø)
lib/internal/test_runner/tests_stream.js 93.08% <100.00%> (+0.06%) ⬆️

... and 35 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

needs-ci PRs that need a full CI run. test_runner Issues and PRs related to the test runner subsystem.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants