tix/flake.nix

66 lines
1.5 KiB
Nix
Raw Normal View History

2024-01-02 09:02:41 +00:00
{
description = "A testing library for nix";
2024-01-02 11:13:47 +00:00
outputs = {
self,
nixpkgs,
}: let
system = "x86_64-linux";
pkgs = import nixpkgs {inherit system;};
2024-01-02 12:44:07 +00:00
tix = import ./tix/. {inherit pkgs;};
2024-01-02 11:13:47 +00:00
in
2024-01-02 13:15:50 +00:00
tix
// {
2024-01-03 19:18:54 +00:00
formatter.x86_64-linux = pkgs.alejandra;
2024-01-02 12:44:07 +00:00
packages.x86_64-linux.test = tix.run [
./test/it.test.nix
./test/test.test.nix
2024-01-02 13:15:50 +00:00
./test/describe.test.nix
2024-01-03 01:27:47 +00:00
./test/watch.test.nix
2024-12-08 21:27:18 +00:00
({
describe,
it,
...
}: [
(describe "suite" [
(it "runs this test" {
actual = true;
expected = true;
})
])
(it "runs another test" {
actual = true;
expected = true;
})
])
2024-01-02 12:44:07 +00:00
];
2024-01-03 06:47:16 +00:00
2024-01-02 12:44:07 +00:00
packages.x86_64-linux.example = tix.run [
./mytest.nix
];
2024-01-03 06:47:16 +00:00
2024-01-03 10:14:28 +00:00
packages.x86_64-linux.watchpipe = tix.watch {
2024-12-08 21:27:18 +00:00
cmd = "nix run --show-trace .#test -- file";
2024-01-03 06:47:16 +00:00
view = "tee -a /tmp/tix-output";
2024-01-03 03:07:39 +00:00
};
2024-01-03 06:47:16 +00:00
2024-01-03 10:14:28 +00:00
packages.x86_64-linux.watch = tix.watch {
2024-12-08 21:27:18 +00:00
cmd = "nix run --show-trace .#test -- $2";
view = ''
${pkgs.lib.getExe pkgs.bat} \
--paging=never --language=''${2:-json} --file-name="test results"'';
2024-01-03 10:14:28 +00:00
};
2024-01-03 06:47:16 +00:00
packages.x86_64-linux.results = pkgs.writeShellScriptBin "results" ''
tail -f -n1 /tmp/tix-output | {
while read out
do
clear
jq '${tix.filters.overview}' $out
done
}
'';
2024-01-02 11:13:47 +00:00
};
2024-01-02 09:02:41 +00:00
}