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

BufferedConsole doesn't work with winston in master. #8020

Closed
natealcedo opened this issue Mar 2, 2019 · 4 comments · Fixed by #8021
Closed

BufferedConsole doesn't work with winston in master. #8020

natealcedo opened this issue Mar 2, 2019 · 4 comments · Fixed by #8021

Comments

@natealcedo
Copy link

natealcedo commented Mar 2, 2019

💥 Regression Report

Running jest with a local build of jest using yarn link on a project that uses winston for logging and setting verbose: false causes jest to fail with

    TypeError: message.split is not a function

      at buffer.reduce (../jest/packages/jest-util/build/getConsoleOutput.js:54:8)
          at Array.reduce (<anonymous>)

Setting verbose: false configures jest to use BufferedConsole.

I've locally built jest on master and added in a console.log call in runTest in the jest-runner package to log which Console is being used. Ideally we could have an integration test for this but I don't know how to write an integration test with a dependency in it.

Last working version

Worked up to version: 24.1.0

Stopped working in version: master

To Reproduce

Steps to reproduce the behavior:

Setup any projects using winston and use the local version of jest and set verbose: false in the jest config

Expected behavior

Here's a screenshot with jest at 24.1

image

And here's running the same test suite with jest at master. Note that I built it with a console log to verify which Console is being used.

image

Link to repl or repo (highly encouraged)

Here's a repo that I've made. I've left instructions and what I think is happening.

https://github.com/natealcedo/buffered-console-repro

Issues without a reproduction link are likely to stall.

Run npx envinfo --preset jest

Paste the results here:

  System:
    OS: macOS 10.14.3
    CPU: (12) x64 Intel(R) Core(TM) i7-8750H CPU @ 2.20GHz
  Binaries:
    Node: 8.15.0 - ~/.nvm/versions/node/v8.15.0/bin/node
    Yarn: 1.13.0 - ~/.nvm/versions/node/v8.15.0/bin/yarn
    npm: 6.4.1 - ~/.nvm/versions/node/v8.15.0/bin/npm
  npmPackages:
    jest: ^24.1.0 => 24.1.0 
@SimenB
Copy link
Member

SimenB commented Mar 2, 2019

This is probably me messing up when converting it to TS - it forced me to change the signature of the functions. Good catch if that's the case!

Ideally we could have an integration test for this but I don't know how to write an integration test with a dependency in it.

We have quite a few integration tests that has a step which is run yarn to install dependencies. E.g. https://github.com/facebook/jest/blob/392a815acb978820967f6539ded446b7be4b8762/e2e/__tests__/typescriptCoverage.test.ts#L15

@natealcedo
Copy link
Author

Oh great. I'm able to create an integration test for it locally and re-create the error. I'm happy to take a look into it to fix it if you could point me in the right direction. I'm guessing BufferedConsole is a good place to start? Or if it's easier for you to amend the regression that's fine by me

@SimenB
Copy link
Member

SimenB commented Mar 2, 2019

I haven't looked into it. But feel free to open up a PR with just the failing test, and I can take a look and maybe point in the right direction 🙂

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

Successfully merging a pull request may close this issue.

2 participants