ndmitchell / ghcid

Very low feature GHCi based IDE
Other
1.13k stars 114 forks source link

Include --test output in --outputfile? #116

Open Wizek opened 6 years ago

Wizek commented 6 years ago

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 commented 6 years ago

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

ndmitchell commented 6 years ago

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

ndmitchell commented 6 years ago

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.

Wizek commented 6 years ago

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:

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.:

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).

mklinik commented 1 year ago

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.