add Readme, remove fx
This commit is contained in:
parent
249bd9cda4
commit
b800bb4695
58
README.md
Normal file
58
README.md
Normal file
|
@ -0,0 +1,58 @@
|
|||
|
||||
# Tix
|
||||
|
||||
Test your Nix is only ticks.
|
||||
|
||||
## Usage
|
||||
|
||||
Make a test file:
|
||||
|
||||
```mytest.nix
|
||||
{ it, ... }:
|
||||
[
|
||||
(it "can add numbers" {
|
||||
actual = 2 + 2;
|
||||
expected = 4;
|
||||
})
|
||||
(it "loves big brother" {
|
||||
actual = 2 + 2;
|
||||
expected = 5;
|
||||
})
|
||||
]
|
||||
```
|
||||
|
||||
Add tix as an input to your flake, and use it to build a test output.
|
||||
|
||||
```flake.nix
|
||||
{
|
||||
description = "My test driven flake";
|
||||
|
||||
inputs = {
|
||||
tix.url = "git+https://git.tristans.cloud/tristan/tix";
|
||||
};
|
||||
|
||||
outpts = {self, tix, ...}: {
|
||||
packages.x86_64-linux.test = tix.run [
|
||||
./mytest.nix
|
||||
];
|
||||
};
|
||||
}
|
||||
```
|
||||
|
||||
Then run the generated package.
|
||||
|
||||
```sh
|
||||
nix run .#test --show-trace
|
||||
```
|
||||
|
||||
Watch for changes while you are developing your package by adding a new output.
|
||||
|
||||
```flake.nix
|
||||
tix.watch "nix run .#test | ${pkgs.fx}/bin/fx" "fx";
|
||||
```
|
||||
|
||||
I am piping the output into `fx` so I can navigate it easier.
|
||||
|
||||
`"fx"` is the process name that must be killed before rerunning.
|
||||
|
||||
|
|
@ -12,5 +12,5 @@ let
|
|||
}
|
||||
'';
|
||||
in (pkgs.writeShellScriptBin "test" ''
|
||||
cat '${resFile}' | ${pkgs.jq}/bin/jq '${filter}' | ${pkgs.fx}/bin/fx
|
||||
cat '${resFile}' | ${pkgs.jq}/bin/jq '${filter}'
|
||||
'')
|
||||
|
|
Loading…
Reference in a new issue