nixite/testing/run.nix

17 lines
465 B
Nix
Raw Normal View History

2024-01-02 04:01:19 +00:00
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
'')