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

jest stops after first instance of console.log using Windows #110

Closed
malonecj opened this issue Aug 6, 2014 · 8 comments
Closed

jest stops after first instance of console.log using Windows #110

malonecj opened this issue Aug 6, 2014 · 8 comments

Comments

@malonecj
Copy link

malonecj commented Aug 6, 2014

I'm running Jest on a Windows 7 machine. There is very little information output to the console. I think this might possibly be related to nodejs/node-v0.x-archive#3479 and nodejs/node-v0.x-archive#3584

When I first setup Jest, for 1 test file containing multiple tests the only console output I could see was

npm ERR! Test failed.  See
npm ERR! not ok code 0

I then began digging in to see why there was no more information logged.

In jest-cli/src/defaultTestResultHandler, the defaultTestResultHandler receives a testResult object that upon debugging, I found contained a complete summary of all test cases. It then goes about logging the information in that object to the console. However after the first time console.log is called, jest exits.

As a quick test, I removed the first instance of console.log in defaultTestResultHandler on line 105

  console.log(_getResultHeader(allTestsPassed, pathStr, [
    testRunTimeString
  ]));

and found that more information was logged to the console. As I repeated this process, I eventually got to see a nicely formatted message of why my test failed

@malonecj
Copy link
Author

malonecj commented Aug 6, 2014

yep. It's definitely related to calling process.exit

If I remove process.exit(success ? 0 : 1); from bin/jest.js, the entire log is output to the console. Will have a look to see if there is a workaround

@michalradziwon
Copy link

Thanks, that also works for my Windows7 (removing the process.exit(success ? 0 : 1); line);

@stkb
Copy link

stkb commented Dec 4, 2014

Did this fix make it into 0.2.0? Because I'm still experiencing it (on Windows 8.1), but it's weird. I tried with the "Getting Started" example.

Edit: I should have not been lazy and just looked myself. I see that the change hasn't made it in yet. Using @mkristo 's fork works fine

poteto added a commit to poteto/jest that referenced this issue Dec 11, 2014
…utput is truncated when pipe-directing stdout or stderr
@poteto
Copy link

poteto commented Dec 12, 2014

This fix doesn't work anymore on 0.2.1 unfortunately...

@jhemminger
Copy link

+1 for getting this fixed. Without the #111 workaround using Jest on a windows box is essentially useless.

@Janekk
Copy link

Janekk commented Dec 31, 2014

+1

@jeffmo
Copy link
Contributor

jeffmo commented Jan 23, 2015

Updated merge in #224

@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

7 participants