ghcid icon indicating copy to clipboard operation
ghcid copied to clipboard

Include --test output in --outputfile?

Open Wizek opened this issue 8 years ago • 6 comments

Wizek avatar Dec 05 '17 13:12 Wizek

I've found a workaround for now:

$ ghcid -c "ghci Main.hs" -T ":main --color -o ghcid-output.txt" -o ghcid-output.txt

Although it's not exactly ideal since hspec's -o redirects to the file, and it would be nice being able to see the results in the ghcid window in addition to writing to the file.

I guess I can work around this side-effect of the workaround like this:

$ watch --color -n0.1 cat ghcid-output.txt

Although I wouldn't mind something like this being more supported either in ghcid, or perhaps in hspec.

Wizek avatar Dec 05 '17 13:12 Wizek

Oh, and I found another shortcoming of the workaround: print, trace, et al don't get written to the output file.

Wizek avatar Dec 05 '17 14:12 Wizek

A very reasonable request, although one I probably won't get to for a little while.

ndmitchell avatar Dec 06 '17 15:12 ndmitchell

In fact, what's the motivation for having the test in the output? Generally the output was meant to be parsed by an IDE (that's why it was written in the first place), and it occurs to me that sending to the test output there too would make things harder for that.

ndmitchell avatar Apr 08 '18 21:04 ndmitchell

I'm now seeing this comment of yours, and I admit I don't fully remember my motivation for this ticket. If I gather correctly, it might have had to do with these issues:

  • https://github.com/ghcjs/jsaddle/issues/48
  • https://github.com/ndmitchell/ghcid/issues/137

Or maybe, it had to do with an experiment I was doing at the time with auto-committing with git on all changes of my files, and I wanted to persist ghcid output alongside, e.g.:

  • https://bitbucket.org/Wizek/advent-of-code-2017/commits/44dddb84a8e6c4f1409a863f07c7e342ac750c13
  • https://bitbucket.org/Wizek/advent-of-code-2017/commits/all

to be able to perfectly preserve and replay a development workflow with each exact step taken.

It's not a pressing or high priority issue for me since then, but if it's easy to add sometime later I think it makes sense to have this as an option (perhaps as a separate option from the IDE-friendly output).

Wizek avatar Aug 17 '18 09:08 Wizek

When hspec fails, it writes the source location of the failed test to stdout. This would allow your IDE to jump directly to the failed assertion.

mklinik avatar Mar 06 '23 11:03 mklinik