-
-
Notifications
You must be signed in to change notification settings - Fork 6.5k
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
Force redirecting stdout to stderr if useStderr is passed #8091
Conversation
Hoho, a bajillion failures 😬 Super excited about this though Sorta related: #6583 |
All errors look however related to coloring :/ |
Yeah, as @mjesun said, all errors but one are caused by colors. I have a version with that fixed but I want to try to get a closest fake copy of stdout and stderr. |
Cool, that should make #6524 simpler as well |
Oh @SimenB, sorry I didn't see that one. I can fix the errors in tests by simply making the pass-through stream that I define as I think we should "copy" (actually using the real value via a getter) the information about the terminal (so we can use that to determine if we can use colors, for example) and define noops for the methods with side-effects. Thoughts? |
IMO we should provide For now, I think the suggestion @rubennorte made is good enough; so happy to go ahead with it. Copying information is not required since instantiating the streams over the |
@@ -5,6 +5,7 @@ | |||
* LICENSE file in the root directory of this source tree. | |||
*/ | |||
|
|||
import {PassThrough} from 'stream'; |
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.
should we import from readable-stream
instead to avoid inconsistencies between node versions?
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.
Yeah, we can do that, given that we're already depending on that module transitively.
Yeah, agreed! |
@mjesun how would your solution behave regarding the mutating methods? AFAIK if you use the same fd you'd be sending those commands to the real terminal (unless you're also suggesting we should make those noops). |
Even though this could be considered a fix, we can wait until the next major to ship it. It's pretty breaking if someone is depending on the current observable behaviour, which isn't unlikely. |
Definitely agree with waiting for 25 to ship this. Potentially add a new flag allowing opt-in, then make the behavior the default and remove the flag in 25? |
This pull request has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. |
Summary
Right now anything written to
process.stdout
in a test (or in a worker) goes to stdout even ifuseStderr
is passed. This breaks JSON output if a test explicitly writes to stdout or if a worker runs out of memory (v8 prints directly to stdout :S), which we handle correctly making the test fail.Test plan
Updated tests.