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

Allow buffering console when running a single test #6441

Open
jamietre opened this issue Jun 11, 2018 · 5 comments
Open

Allow buffering console when running a single test #6441

jamietre opened this issue Jun 11, 2018 · 5 comments

Comments

@jamietre
Copy link
Contributor

jamietre commented Jun 11, 2018

🐛 Bug Report

Splitting this from this issue: #4156 (comment)

In scenarios involving running multiple tests, console output is buffered and can be intercepted by a test reporter. When only a single test runs, the output is never buffered. This behavior is mentioned here: #2080

To Reproduce

Initiate a test run that matches only a single test.

Expected behavior

In a reporter, TestResult.console should be populated for all test run scenarios (at least optionally).

Run npx envinfo --preset jest

Paste the results here:

  System:
    OS: macOS High Sierra 10.13.5
    CPU: x64 Intel(R) Core(TM) i7-7920HQ CPU @ 3.10GHz
  Binaries:
    Node: 8.9.4 - ~/.nvm/versions/node/v8.9.4/bin/node
    Yarn: 1.6.0 - /usr/local/bin/yarn
    npm: 5.6.0 - ~/.nvm/versions/node/v8.9.4/bin/npm
  npmPackages:
    @types/jest: 22.2.3 => 22.2.3
    jest: =23.1.0 => 23.1.0
@kumar303
Copy link

kumar303 commented Aug 8, 2018

I guess #2080 (comment) is the reason for why output is never buffered for single test runs but I don't understand this part:

This is an escape hatch – if you have an infinite loop and we buffer console messages, none will show up at all.

Is Jest optimizing for when a developer accidentally introduces an infinite loop? Is it saying that running a single test provides the developer with an escape hatch? If so, that seems like a pretty uncommon use case.

@SimenB
Copy link
Member

SimenB commented Aug 18, 2018

Should be doable. You can do --verbose to turn off buffering

@pierrezimmermannbam
Copy link

@SimenB any update on this ? I'd like to make my tests fail when there are some errors logged and using reporters is the only way I've found that allows me not to lose the stack trace in logged errors. Plus I think the errors being shown above test result are less visible and tend to be ignored. I'd be glad to help if this is something that is doable

@SimenB
Copy link
Member

SimenB commented Feb 27, 2022

PR welcome!

@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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants