Open mmontin opened 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)
Is it really buggy though? It works on my environements? Could it be linked to direnv? @florentc
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.
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.