Repository navigation
Test Runner: delegate arbitrary output formatting to each reporter #48011
Description
Activity
- addedfeature requestIssues requesting new Node.js features.Issues requesting new Node.js features.test_runnerIssues and PRs related to the test runner subsystem.Issues and PRs related to the test runner subsystem.
on May 15, 2023 CC @nodejs/test_runner
one thing that is TAP oriented and might be harder to change is the fact we direct any output on
stderrtostdout- but that might make sense in the context of a test runner.Hi @MoLow ,
Is anyone from test runner team working on it? Or is it open for anyone to try?
It seems that it's still being discussed 🤔@HinataKah0 I first want to gather feedback regarding this issue, then it makes sense to only work on it after #47867 lands
Reacted by HinataKah0I have discussed this with @cjihrig and he says it makes sense to him.
@HinataKah0 do you want to implement this?Reacted by HinataKah0I'll be happy to try 😄
Will send a PR so we can discuss as well (I hope I don't misunderstand anything)Reacted by Moshe Atlowone thing that is TAP oriented and might be harder to change is the fact we direct any output on
stderrtostdout- but that might make sense in the context of a test runner.I think it makes sense for the test runner to collect both stdout and stderr from the child processes and direct them to the same place. For example, if the reporter destination is a file, having stdout and stderr both sent to the file is helpful for reviewing the output at a later time. If stderr is not sent to the reporter destination, there would be no way of recovering it later.
Reacted by Moshe Atlow- added a commit that references this issue
on May 23, 2023 - added a commit that references this issue
on May 30, 2023 - added a commit that references this issue
on Jul 6, 2023 - added a commit that references this issue
on Jul 6, 2023 - added 2 commits that reference this issue
on Aug 14, 2023
What is the problem this feature will solve?
The current implementation of the test runner (
--test) is very TAP oriented,so we have decided (#43525 (comment), #45618) to treat any arbitrary output as a test diagnostic.
I do agree this decision makes sense when using TAP as the reporter, but I think we can provide better DX for console logs or other arbitrary output when using other reporters.
What is the feature you are proposing to solve the problem?
add a new event emitted by
TestsStream, perhapstest:stdoutortest:unknown(or whatever) so each reporter can decide how to treat unknown output.I think
console.log("test")should show the same when runningnode --test-reporter spec test.jsandnode --test --test-reporter spec test.js(probably also the same colors etc, but that probably justifies a separate issue)What alternatives have you considered?
No response