From a60eba976f827f9f5417079603cb9aadd9f243a0 Mon Sep 17 00:00:00 2001 From: tristan Date: Wed, 3 Jan 2024 11:17:47 +0000 Subject: [PATCH] better jq filter --- test/watch.test.nix | 7 ++++--- tix/filters.nix | 24 ++++++++++++------------ 2 files changed, 16 insertions(+), 15 deletions(-) diff --git a/test/watch.test.nix b/test/watch.test.nix index 595a2bc..3f6e14c 100644 --- a/test/watch.test.nix +++ b/test/watch.test.nix @@ -8,12 +8,13 @@ inotify-tools = "inotify-tools"; }; watch = import ../tix/watch.nix mockpkgs; -in - describe "watch" [ +in [ + (describe "watch" [ (it "contains the command" { actual = builtins.match ".*(run me).*" (watch { cmd = "run me"; }); expected = ["run me"]; }) - ] + ]) +] diff --git a/tix/filters.nix b/tix/filters.nix index 2880425..ce0ad5b 100644 --- a/tix/filters.nix +++ b/tix/filters.nix @@ -1,17 +1,17 @@ let emotes = import ./emotes.nix; -in { - overview = '' - .[] | { - (.path): - .results[] | { - (.component): { - "${emotes.fail}": [ - .results | map(select(.success==false))[] | {(.msg): {actual, expected}} - ], - "${emotes.pass}": .results | map(select(.success) | .msg) | length - } +in rec { + failures = '' + [. | map(select(.results[].results[].success == false))[] + | { + (.path): .results | map(select(.results[].success == false))[] + | { + (.component): .results | map(select(.success == false))[] + | { + (.msg): {success, expected, actual} } - } + } + }] | add ''; + overview = failures; }