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

--listTests with --forceExit doesn't flush the whole STDOUT #4274

Closed
aaronabramov opened this issue Aug 15, 2017 · 9 comments
Closed

--listTests with --forceExit doesn't flush the whole STDOUT #4274

aaronabramov opened this issue Aug 15, 2017 · 9 comments
Labels

Comments

@aaronabramov
Copy link
Contributor

when using --listTests --json flag together with forceExit config it might produce corrupted JSON, because the process exits before the whole STDOUT is flushed.
Since we don't run any tests in --listTests mode we should disable forceExit even if it's set to true

@rogeliog
Copy link
Contributor

I've been having some trouble reproducing it... This is what I've been runningjest --listTests --json --forceExit

@aaronabramov
Copy link
Contributor Author

@rogeliog it only happens with very large output (for me it was when the output string was longer than 16 bit or 65536 characters)
here's the node bug for it nodejs/node#784

@rogeliog
Copy link
Contributor

I can help by putting the fix but I'm still having some trouble reproducing it... I printed 4.9M

@aaronabramov
Copy link
Contributor Author

@rogeliog the original node issues says that it works synchronously on TTY terminals now, so that shouldn't reproduce in you local terminal. I was able to reproduce it by spawning a child process though

@aaronabramov
Copy link
Contributor Author

seems like the issue is worse than i first though.
--json will always break the JSON if the output is longer than 65538 char and --forceExit is passed :(
just hit this issue on a large test run with --json flag

@trevor-bliss
Copy link

Any update for this one?

As a workaround, I'm using --outputFile to write the results to a temporary file and then doing post-processing against the file after the test run completes.

@github-actions
Copy link

This issue is stale because it has been open for 1 year with no activity. Remove stale label or comment or this will be closed in 30 days.

@github-actions github-actions bot added the Stale label Feb 26, 2022
@github-actions
Copy link

This issue was closed because it has been stalled for 7 days with no activity. Please open a new issue if the issue is still relevant, linking to this one.

@github-actions
Copy link

This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.
Please note this issue tracker is not a help forum. We recommend using StackOverflow or our discord channel for questions.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Apr 28, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

3 participants