-
Notifications
You must be signed in to change notification settings - Fork 29.8k
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.
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
test_runner: delegate stderr and stdout formatting to reporter #48045
test_runner: delegate stderr and stdout formatting to reporter #48045
Conversation
Review requested:
|
lib/internal/test_runner/runner.js
Outdated
@@ -285,7 +285,7 @@ class FileTest extends Test { | |||
const message = messages[i]; | |||
this.addToReport({ | |||
__proto__: null, | |||
type: 'test:diagnostic', | |||
type: 'test:stdout', | |||
data: { __proto__: null, nesting: 0, file: this.name, message }, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
as you have mentioned, nesting
is redundant here.
also, I think we should stop breaking this into lines and delegate that to the TAP reporter (and leave as is in spec reporter) - but that dosnt have to happen in this PR
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we should stop breaking this into lines and delegate that to the TAP reporter (and leave as is in spec reporter)
Sorry I don't get the spec reporter part. By "leaving as it is" are you referring to printing \n
as \\n
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry I don't get the spec reporter part. By "leaving as it is" are you referring to printing \n as \n?
I was referring to the output being split into lines before passing it to the reporter:
node/lib/internal/test_runner/runner.js
Line 283 in 3473edc
const messages = RegExpPrototypeSymbolSplit(kSplitLine, nonSerialized.toString('utf-8')); |
but as written, it is also ok to not include it in this PR
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'll address it in separate PR 👍
6e503ca
to
3473edc
Compare
I think TAP should stay the same as today, and spec should just pipe the original data. that is the goal |
3473edc
to
16f1020
Compare
Introduce new `TestsStream` events `test:stderr` and `test:stdout` to delegate `stderr` and `stdout` (e.g. `console.log()`) formatting to the reporter. And patch existing reporters to: - Spec: output the message as it is - TAP: stay the same with existing `test:diagnostic`
16f1020
to
67f3543
Compare
### Event: `'test:stderr'` | ||
|
||
* `data` {Object} | ||
* `file` {string} The path of the test file. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For the test:diagnostic
event, this can also be undefined
. Is that possible for these new events?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
no. test:diagnostic
can be produced inside the REPL. these new events are only useful with --test
Landed in 1229a22 |
Introduce new `TestsStream` events `test:stderr` and `test:stdout` to delegate `stderr` and `stdout` (e.g. `console.log()`) formatting to the reporter. And patch existing reporters to: - Spec: output the message as it is - TAP: stay the same with existing `test:diagnostic` PR-URL: #48045 Fixes: #48011 Reviewed-By: Moshe Atlow <moshe@atlow.co.il> Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Introduce new `TestsStream` events `test:stderr` and `test:stdout` to delegate `stderr` and `stdout` (e.g. `console.log()`) formatting to the reporter. And patch existing reporters to: - Spec: output the message as it is - TAP: stay the same with existing `test:diagnostic` PR-URL: #48045 Fixes: #48011 Reviewed-By: Moshe Atlow <moshe@atlow.co.il> Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Introduce new `TestsStream` events `test:stderr` and `test:stdout` to delegate `stderr` and `stdout` (e.g. `console.log()`) formatting to the reporter. And patch existing reporters to: - Spec: output the message as it is - TAP: stay the same with existing `test:diagnostic` PR-URL: nodejs#48045 Fixes: nodejs#48011 Reviewed-By: Moshe Atlow <moshe@atlow.co.il> Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Introduce new `TestsStream` events `test:stderr` and `test:stdout` to delegate `stderr` and `stdout` (e.g. `console.log()`) formatting to the reporter. And patch existing reporters to: - Spec: output the message as it is - TAP: stay the same with existing `test:diagnostic` PR-URL: nodejs#48045 Fixes: nodejs#48011 Reviewed-By: Moshe Atlow <moshe@atlow.co.il> Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Introduce new `TestsStream` events `test:stderr` and `test:stdout` to delegate `stderr` and `stdout` (e.g. `console.log()`) formatting to the reporter. And patch existing reporters to: - Spec: output the message as it is - TAP: stay the same with existing `test:diagnostic` PR-URL: nodejs#48045 Fixes: nodejs#48011 Reviewed-By: Moshe Atlow <moshe@atlow.co.il> Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Introduce new
TestsStream
eventstest:stderr
andtest:stdout
to delegate
stderr
andstdout
(e.g.console.log()
) formattingto the reporter. And patch existing reporters to:
test:diagnostic
Fixes: #48011