-
Notifications
You must be signed in to change notification settings - Fork 787
Output truncated in Node 6 #620
Comments
Some more information. The reports are written on the process exit event but the docs state that
Since "the console functions are asynchronous unless the destination is a file" (source) this causes the problem with the truncated output. The node process will exit early before the console output is completely written. |
this is such a pain in the ass! |
This is probably a better issue to watch. Looks like a lot of CLI tools are breaking in Node 6 without a viable workaround. Guess we all need to wait for a solution to land in Node. Another note, although I didn't test the new alpha, I did pick through the code and it looks like the issue would still be present. |
@MitMaro I think that if Node.js fixes a long standing bug and that causes a lot of tools, that do what they shouldn't, to break I do not think that it's Node that needs to come up with a solution, but those tools need to adapt. |
I agree, it should be up to the various tools that use the broken behaviour to fix the problem. However, from reading the issues on the Node project, there doesn't seem to be a viable way to fix the problem at the moment as Node doesn't currently have a way to wait for (or force) There is a As an aside isaacs has stated in a comment that perhaps this is something that Node may need to fix as there are many tools have used this broken behaviour for some time. |
Unfortunately the Node docs say nothing about the exact behavior of `process.exit (all they say is "Ends the process with the specified code."), so users had no choice but to assume the observed behavior was expected. Since that behavior remained consistent for several years, it's hard to blame the users. On the other hand, I'm wondering how such a huge breaking change made it past the Node test suite. In any case, there is a temporary fix. |
Thought I already posted this, but this has been mostly fixed in Node v6.2.1. There is an outstanding issue that is tracking the overall problem. |
Problem
The text reporter has truncated output in Node 6.
Minimal Test Case
Test case repo
Expected Output
Result of running with Node v4.4.4 and v5.11.1
Actual Output
Result from running in Node 6.1.0
Investigation
I drilled down to
lib/report/text.js:228
andtext
at this point contains the complete expected output. So it seems there is an issue with Node 6 andconsole.log
. After some research I came across this issue. If you read through the comments it comes down to a change in libuv around non-blocking I/O with stdout.On a suggestion found in the linked issue above, I changed
lib/report/text.js:228
to instead be the following, which apparent forces stdout to be blocking and Istanbul works as expected. I am not sure if this is the correct way to fix the issue, but it does show that stdout not blocking, to be the issue.System
Notes
It is possible that the above test case will pass if there isn't enough output.
The text was updated successfully, but these errors were encountered: