tweag / cooked-validators

MIT License
39 stars 11 forks source link

Update the `cabal test all` command to hide verbose output #402

Open mmontin opened 6 months ago

mmontin commented 6 months ago

For now, we have a hack in our flake to redefine cabal test all such that it provides coverage information. This could be improved, especially since our regular expression hiding excessive output of the commande seem to not work on some machines.

florentc commented 6 months ago

We could introduce aliases in our dev environment shell to launch cabal test all with or without coverage analysis. For example cooked-test and cooked-test-coverage. Most of the time we don't care about the coverage analysis and we would launch cooked-test, we only check coverage punctually (in which case having excessive output once is not a big deal) and would then launch cooked-test-coverage. (or any better names)

mmontin commented 5 months ago

Is it really buggy though? It works on my environements? Could it be linked to direnv? @florentc

florentc commented 5 months ago

Yes it is linked to direnv.

The current shellHook defines and exports a shell function to override cabal. When going in the dev shell with nix develop, you end up in a bash shell where this works.

In my case, I use direnv so I actually stay in the same shell (zsh instead of bash) where for some reason this override does not work (anymore? I remember it used to).

The shellHook does work with direnv and other shells such as zsh usually. I use shell hooks in other projects with direnv + zsh without any issue. Here, if I add an export (e.g export FOO=1), I get 1 as an output to echo $FOO in my environment enhanced by direnv. So I think the issue is just that defining a function then exporting it with export -f is not the way to go in zsh. Even when using zsh compatible syntax it doesn't work. It seems that direnv doesn't make it possible to inherit functions from the shell hook.

We could consider this a non issue because it is: if you play by the rules (nix develop) it works. However, I think my workflow is quite common in practice so if we find some easy fix let's do it.

In any case, this is extremely low priority.