From 84693ad125b63d737efa24b0e9c49f40d1d1c47b Mon Sep 17 00:00:00 2001 From: Florent C Date: Fri, 16 Feb 2024 19:04:14 +0100 Subject: [PATCH] Tests with coverage (#372) * adding cabal-test alias to run test with coverage witout too much noise * Define a cabal wrapper in the flake to remove annoying test junk output --------- Co-authored-by: mmontin --- cabal.project | 5 ++++- flake.nix | 16 +++++++++++++++- 2 files changed, 19 insertions(+), 2 deletions(-) diff --git a/cabal.project b/cabal.project index c37ea17d2..255788306 100644 --- a/cabal.project +++ b/cabal.project @@ -1,6 +1,10 @@ packages: . +package cooked-validators + coverage: True + library-coverage: True + package cardano-crypto-praos flags: -external-libsodium-vrf @@ -24,7 +28,6 @@ source-repository-package -- Everything below this point has been copied from plutus-apps' cabal.project - -- Custom repository for cardano haskell packages -- See https://github.com/input-output-hk/cardano-haskell-packages on how to use CHaP in a Haskell project. repository cardano-haskell-packages diff --git a/flake.nix b/flake.nix index d826e19eb..35b4cb0c3 100644 --- a/flake.nix +++ b/flake.nix @@ -69,9 +69,23 @@ ## one pinned by HLS. buildInputs = buildInputs ++ (with pkgs; [ ormolu hpack hlint ]) ++ (with hpkgs; [ haskell-language-server ]); - inherit (pre-commit) shellHook; + inherit LD_LIBRARY_PATH; inherit LANG; + + # In addition to the pre-commit hooks, this redefines a cabal + # command that gets rid of annoying "Writing: .....*.html" output + # when running cabal test. + shellHook = pre-commit.shellHook + '' + function cabal() { + if [ "$1" != "test" ]; then + command cabal $@ + else + command cabal --test-option=--color=always $@ | grep -vE --color=never "^Writing:.*html$" + fi + } + export -f cabal + ''; }; };