tix/testing/run.nix

16 lines
445 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}'
'')