test_runner: add context.log() and test:log event#64389
Open
MoLow wants to merge 1 commit into
Open
Conversation
Collaborator
|
Review requested:
|
Add a log(message[, data]) method to TestContext and SuiteContext that emits a new test:log event. Unlike test:diagnostic, which is buffered so it is emitted in the order tests are defined, test:log is emitted immediately, in the order tests execute, including under process isolation where it bypasses the per-file declaration order buffer. This gives reporters that render the test tree unbuffered a live, attributed logging channel that captured stdout cannot provide under concurrency. The event carries the message, an optional opaque structured payload that the runner passes through untouched, and the emitting test's name, testId, parentId, nesting, and location. Built-in reporters render it the same way they render test:diagnostic. Signed-off-by: Moses Atlow <moshe@atlow.co.il>
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #64389 +/- ##
=======================================
Coverage 90.25% 90.25%
=======================================
Files 741 741
Lines 241207 241242 +35
Branches 45424 45436 +12
=======================================
+ Hits 217696 217733 +37
+ Misses 15087 15079 -8
- Partials 8424 8430 +6
🚀 New features to boost your workflow:
|
benjamingr
approved these changes
Jul 9, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Add a log(message[, data]) method to
TestContextandSuiteContextthat emits a newtest:logevent.Unlike
test:diagnostic, which is buffered so it is emitted in the order tests are defined,test:logis emitted immediately, in the order tests execute, including under process isolation where it bypasses the per-file declaration order buffer.Motivation for adding this
This gives reporters that render the test tree unbuffered a live, attributed logging channel that captured stdout cannot provide under concurrency (see for example https://www.npmjs.com/package/@reporters/live and https://www.npmjs.com/package/@reporters/web).
The event carries the message, an optional opaque structured payload that the runner passes through untouched, and the emitting test's name, testId, parentId, nesting, and location.
Built-in reporters render it the same way they render
test:diagnostic.