Skip to content

Commit

Permalink
Tests with coverage (#372)
Browse files Browse the repository at this point in the history
* 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 <mathieu.montin@tweag.io>
  • Loading branch information
florentc and mmontin authored Feb 16, 2024
1 parent b0aaec1 commit 84693ad
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 2 deletions.
5 changes: 4 additions & 1 deletion cabal.project
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
packages:
.

package cooked-validators
coverage: True
library-coverage: True

package cardano-crypto-praos
flags: -external-libsodium-vrf

Expand All @@ -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
Expand Down
16 changes: 15 additions & 1 deletion flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -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
'';
};
};

Expand Down

0 comments on commit 84693ad

Please sign in to comment.