diff --git a/tix/describe.nix b/tix/describe.nix index c83179d..0a78fc6 100644 --- a/tix/describe.nix +++ b/tix/describe.nix @@ -1,5 +1,5 @@ name: -builtins.trace "testing ${name}" +builtins.trace "tix: ├── ${name}" map ({ msg, success, diff --git a/tix/emotes.nix b/tix/emotes.nix new file mode 100644 index 0000000..c8eec46 --- /dev/null +++ b/tix/emotes.nix @@ -0,0 +1,4 @@ +{ + pass = "✔️"; + fail = "❌"; +} diff --git a/tix/filters.nix b/tix/filters.nix index cdc95e8..ea8354c 100644 --- a/tix/filters.nix +++ b/tix/filters.nix @@ -1,9 +1,11 @@ -{ +let + emotes = import ./emotes.nix; +in { overview = '' .[] | { (.path): { - "❌": [.results | map(select(.success==false))[] | {(.msg): {actual, expected}}], - "✔️": .results | map(select(.success) | .msg) | length + "${emotes.fail}": [.results | map(select(.success==false))[] | {(.msg): {actual, expected}}], + "${emotes.pass}": .results | map(select(.success) | .msg) | length } } ''; diff --git a/tix/it.nix b/tix/it.nix index e94eb61..a479e64 100644 --- a/tix/it.nix +++ b/tix/it.nix @@ -7,6 +7,8 @@ msg: { safeToPrint ? true, throws ? false, }: let + emotes = import ./emotes.nix; + preProcess = v: if removeDunders then undunder v @@ -24,19 +26,19 @@ msg: { then builtins.removeAttrs v ["__toString" "__functor"] else v; - success = - builtins.trace "testing if it ${msg}" - ( - if throws - then (builtins.tryEval actual).success == false - else (a == e) - ); + success = ( + if throws + then (builtins.tryEval actual).success == false + else (a == e) + ); in { inherit success msg; } // ( if success - then {} - else builtins.trace "FAILED ${msg}" {inherit actual expected;} + then builtins.trace "tix: │ ├── ${emotes.pass} ${msg}" {} + else + builtins.trace "tix: │ ├── ${emotes.fail} ${msg}" + {inherit actual expected;} ) diff --git a/tix/test.nix b/tix/test.nix index 5b08439..ea3727c 100644 --- a/tix/test.nix +++ b/tix/test.nix @@ -3,7 +3,7 @@ path: let describe = import ./describe.nix; suite = import path; in - builtins.trace ("testing " + builtins.baseNameOf path) + builtins.trace ("tix: " + builtins.baseNameOf path) ( if !builtins.isFunction suite then throw "A test suite should be in the form { it }: [ ]."