Skip to content
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

Intercept process.stdout and process.stderr #6524

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

SimenB
Copy link
Member

@SimenB SimenB commented Jun 22, 2018

Summary

Fixes #6311.

Thoughts very much welcome on the implementation. I'm not particularly happy with it. I chose to keep it as a stream so that people doing something.pipe(process.stdout) in their code didn't break.

Test plan

Tests updated.

@SimenB
Copy link
Member Author

SimenB commented Jun 22, 2018

@aaronabramov thoughts?

@SimenB
Copy link
Member Author

SimenB commented Jun 22, 2018

In particular, the case reported in #6311 now runs like this:
image

With --silent:
image

(is it a bug that silent removes "Ran all test suites matching /test_scheduler.test.js/i."?)

@SimenB
Copy link
Member Author

SimenB commented Jun 22, 2018

Seems like it broke colors in error output. Not sure why...

EDIT: isTTY was changed. Copied it over.

It might be a better idea to just replace write? IDK

@SimenB
Copy link
Member Author

SimenB commented Jun 22, 2018

@aaronabramov
Copy link
Contributor

i actually tried getting this into Jest a few times a while ago, but i think @cpojer had some strong opinions against it.
this one only affects the worker processes, and not the main, right?

@SimenB
Copy link
Member Author

SimenB commented Jun 22, 2018

Depending on how process is injected into it, yes. Right now it's a copy (and I just modify the copy) I think, but that can be changed

@SimenB
Copy link
Member Author

SimenB commented Sep 29, 2018

Rebased this, would love to land it

@SimenB SimenB added this to the Jest 24 milestone Nov 7, 2018
@SimenB SimenB force-pushed the intercept-stdout-stderr branch 2 times, most recently from 539bb2f to 799b4e1 Compare November 9, 2018 12:33
@rickhanlonii
Copy link
Member

@cpojer do you have thoughts on this, strong or otherwise?

@cpojer
Copy link
Member

cpojer commented Dec 2, 2018

I am ok with it but I do want to point out that people have been upset about us re-routing console calls. I think I'm probably in favor of merging this, and adding a cli flag that will disable the re-routing for both console and process.stdout/stderr. That way people can choose which one they prefer.

@SimenB
Copy link
Member Author

SimenB commented Dec 3, 2018

Yeah, that's a good idea. Unsure how we can make that happen without messing up when we clear lines to update status etc, but worth looking into

@cpojer
Copy link
Member

cpojer commented May 3, 2020

What's the status of this PR?

@SimenB
Copy link
Member Author

SimenB commented May 3, 2020

I've forgotten about it 😀 I'd like to get back to it at some point though

@SimenB SimenB added this to the High priority future milestone May 4, 2020
@earonesty
Copy link

Might want to take a look at: https://github.com/AtakamaLLC/capio

@SimenB SimenB force-pushed the intercept-stdout-stderr branch from 799b4e1 to 2b98983 Compare August 6, 2020 14:32
@SimenB SimenB force-pushed the intercept-stdout-stderr branch 4 times, most recently from 570cf2b to e470822 Compare August 6, 2020 15:48
@SimenB
Copy link
Member Author

SimenB commented Aug 6, 2020

Just spent almost an hour rebasing this across splitting up jest-util into multiple modules and rewriting to TS 😅 Will try to find the time to look into this soonish

@SimenB SimenB force-pushed the intercept-stdout-stderr branch from e470822 to 0a1f6d8 Compare August 6, 2020 15:57
@SimenB SimenB modified the milestones: High priority future, Jest 27 Aug 6, 2020
@cpojer
Copy link
Member

cpojer commented May 15, 2021

Ping?

@SimenB SimenB modified the milestones: Jest 27, High priority future May 18, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Investigate default reporter broken output
6 participants