test output options
This commit is contained in:
parent
d146127911
commit
4f6c21ec77
7 changed files with 84 additions and 72 deletions
2
tix/eval.nix
Normal file
2
tix/eval.nix
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
resFile:
|
||||
builtins.fromJSON (builtins.unsafeDiscardStringContext (builtins.readFile resFile))
|
||||
10
tix/filters.nix
Normal file
10
tix/filters.nix
Normal file
|
|
@ -0,0 +1,10 @@
|
|||
{
|
||||
overview = ''
|
||||
.[] | {
|
||||
(.path): {
|
||||
"❌": [.results | map(select(.success==false))[] | {(.msg): {actual, expected}}],
|
||||
"✔️": .results | map(select(.success) | .msg) | length
|
||||
}
|
||||
}
|
||||
'';
|
||||
}
|
||||
22
tix/run.nix
22
tix/run.nix
|
|
@ -2,14 +2,18 @@ pkgs: files: let
|
|||
test = import ./test.nix;
|
||||
res = map test files;
|
||||
resFile = builtins.toFile "results" (builtins.toJSON res);
|
||||
filter = ''
|
||||
.[] | {
|
||||
(.path): {
|
||||
"❌": [.results | map(select(.success==false))[] | {(.msg): {actual, expected}}],
|
||||
"✔️": .results | map(select(.success) | .msg) | length
|
||||
}
|
||||
}
|
||||
'';
|
||||
filters = import ./filters.nix;
|
||||
getNix = "import ${./eval.nix} ${resFile}";
|
||||
extractNix = "nix eval --impure --quiet --expr 'let r = ${getNix}; in builtins.trace r r'";
|
||||
nixRepl = "nix repl --expr '{ r = ${getNix}; }'";
|
||||
in (pkgs.writeShellScriptBin "test" ''
|
||||
cat '${resFile}' | ${pkgs.jq}/bin/jq '${filter}'
|
||||
t=$1
|
||||
case "$t" in
|
||||
"raw") cat '${resFile}' ;;
|
||||
"json") jq '.' '${resFile}' ;;
|
||||
"nix") ${extractNix} | ${pkgs.alejandra}/bin/alejandra -q ;;
|
||||
"nixrepl") ${nixRepl} ;;
|
||||
"nixraw") ${extractNix} ;;
|
||||
*) ${pkgs.jq}/bin/jq '${filters.overview}' '${resFile}' ;;
|
||||
esac
|
||||
'')
|
||||
|
|
|
|||
|
|
@ -6,7 +6,11 @@ pkgs: {
|
|||
pkgs.writeShellScriptBin "watch" ''
|
||||
while true
|
||||
do
|
||||
${cmd} ${if view == null then "" else "| ${view} "}&
|
||||
${cmd} ${
|
||||
if view == null
|
||||
then ""
|
||||
else "| ${view} "
|
||||
}&
|
||||
${pkgs.inotify-tools}/bin/inotifywait -e modify -r .
|
||||
${toString stop}
|
||||
done
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue