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

Group console.log buffer by test #2080

Closed
Swatinem opened this issue Nov 11, 2016 · 2 comments
Closed

Group console.log buffer by test #2080

Swatinem opened this issue Nov 11, 2016 · 2 comments

Comments

@Swatinem
Copy link

Do you want to request a feature or report a bug?

both feature and bug

What is the current behavior?

console.logs are intercepted/buffered by jest.
They are output along with source location, but are not grouped in any way. Some console.logs are even output after the test summary, even though they occur inside a test.

If the current behavior is a bug, please provide the steps to reproduce and if possible a minimal repository on GitHub that we can npm install and npm test.

I have some async code using promises and tests with async/await. The code has console.logs and console.time/Ends scattered all over.

What is the expected behavior?

I would like jest to group the console output by test run. At the very least, jest should flush the buffered console.log messages before writing the test summary on the very end.

Run Jest again with --debug and provide the full configuration it prints. Please mention your node and npm version and operating system.

jest 17, node 7.1, archlinux

@cpojer
Copy link
Member

cpojer commented Nov 14, 2016

If you run more than one test, Jest groups the log messages per-test. If you only run a single test or use --verbose, we don't buffer console calls. This is an escape hatch – if you have an infinite loop and we buffer console messages, none will show up at all. I recommend not using --verbose unless you are only running a single test.

@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 May 14, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants