-
Notifications
You must be signed in to change notification settings - Fork 104
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
Using hspec via cabal test --show-details=streaming
truncates output
#232
Comments
@RyanGlScott Thanks for reporting. I don't have access to a Windows machine, so I can't debug this. One thing I'm puzzled is whether this happens if you run the tests standalone, e.g.:
If no, I'm inclined to consider this a |
We don't mess with the buffering. So if the handle is |
@RyanGlScott In case you have the capacity to look into this, I pushed some code that may help to verify that it's due to a buffering issue, see #233. |
Unfortunately, this doesn't seem to happen with I'm not too familiar with how streaming mode in |
There are two more things I'm puzzled about:
Sent from my iPhone
|
That's an interesting question since, as far as I can tell, none of the output gets colorized at all when a test suite is run via (Weirdly enough,
Yes. I've also had this happen with the |
Unless proven otherwise I would not exclude the possibility that this is a |
I ran into an issue somewhat related to this (though not on Windows). In my case, turning on the multithreaded runtime (i.e. |
Ah, it looks like I can reproduce this on Linux with the
When I run the test suite several times in a row with I'll change the title to reflect this. |
cabal test --show-details=streaming
truncates output
I was wondering whether we should run all test suites in Nix with |
FWIW, in Stack we found the test running code from Cabal too unstable to be used, so instead run the test suites ourselves manually, which also allowed more fine-grained control of output redirection. |
Interesting ... I never considered that. I guess I sort-of assumed that Cabal would create some magic, special environment for tests to run in, but now that I think about it, that's probably exactly the kind of thing we don't want. |
IIRC, I found I needed to do two things to get reliable test runs in Stack:
Doing a directly executable run is fairly simple:
|
Note that (following a convention from libc) the default buffering mode for http://stackoverflow.com/questions/19520885/haskell-default-io-buffering This may well explain the difference in behaviour between running a spec directly and running it via a wrapper executable. OTOH when running a subprocess to completion the parent should really take care to read all the way to EOF even after the child process has exited. My guess would be that |
This is a Cabal bug. A workaround is to use
|
When running an
hspec
test suite viacabal test --show-details=streaming
(an option which was added toCabal
in version 1.20) oncmd.exe
or PowerShell on Windows, it only outputs some of the tests. As an example, here is what happens when attempting to run the test suite frombase-orphans
on PowerShell:This doesn't happen on MSYS or Cygwin, curiously enough. For comparison, here is what the test suite should look like:
I'm tempted to think that line buffering is to blame here, as
tasty
once had a similar problem. I'm not familiar withhspec
's internals, though, so I can't say for sure.The text was updated successfully, but these errors were encountered: