tix/testing/run.nix
2024-01-02 09:02:41 +00:00

17 lines
465 B
Nix

pkgs: files:
let
test = import ./import.nix;
res = map test files;
resFile = builtins.toFile "results" (builtins.toJSON res);
filter = ''
.[] | {
(.path): {
failures: [.results | map(select(.success==false))[] | {(.msg): {actual, expected}}],
success: .results | map(select(.success) | .msg) | length
}
}
'';
in (pkgs.writeShellScriptBin "test" ''
cat '${resFile}' | ${pkgs.jq}/bin/jq '${filter}' | ${pkgs.fx}/bin/fx
'')