mirror of
https://gitlab.com/TECHNOFAB/nixtest.git
synced 2025-12-12 02:00:18 +01:00
feat: general improvements and add junit "error" and "skipped" support
This commit is contained in:
parent
5ae5c2dd45
commit
0a1bbae2c3
5 changed files with 181 additions and 105 deletions
113
flake.nix
113
flake.nix
|
|
@ -41,54 +41,71 @@
|
|||
};
|
||||
};
|
||||
|
||||
testSuites = {
|
||||
"suite-one" = [
|
||||
{
|
||||
name = "test-one";
|
||||
# required to figure out file and line, but optional
|
||||
pos = __curPos;
|
||||
expected = 1;
|
||||
actual = 1;
|
||||
}
|
||||
{
|
||||
name = "fail";
|
||||
pos = __curPos;
|
||||
expected = 0;
|
||||
actual = "meow";
|
||||
}
|
||||
{
|
||||
name = "snapshot-test";
|
||||
type = "snapshot";
|
||||
pos = __curPos;
|
||||
actual = "test";
|
||||
}
|
||||
{
|
||||
name = "test-snapshot-drv";
|
||||
type = "snapshot";
|
||||
pos = __curPos;
|
||||
actualDrv = pkgs.runCommand "test-snapshot" {} ''
|
||||
echo '"snapshot drv"' > $out
|
||||
'';
|
||||
}
|
||||
];
|
||||
"other-suite" = [
|
||||
{
|
||||
name = "obj-snapshot";
|
||||
type = "snapshot";
|
||||
pos = __curPos;
|
||||
actual = {hello = "world";};
|
||||
}
|
||||
{
|
||||
name = "test-drv";
|
||||
pos = __curPos;
|
||||
expected = {a = "b";};
|
||||
actualDrv = pkgs.runCommand "test-something" {} ''
|
||||
echo "Simulating taking some time"
|
||||
sleep 1
|
||||
echo '{"a":"b"}' > $out
|
||||
'';
|
||||
}
|
||||
];
|
||||
nixtest = {
|
||||
skip = "skip.*d";
|
||||
suites = {
|
||||
"suite-one" = [
|
||||
{
|
||||
name = "test-one";
|
||||
# required to figure out file and line, but optional
|
||||
pos = __curPos;
|
||||
expected = 1;
|
||||
actual = 1;
|
||||
}
|
||||
{
|
||||
name = "fail";
|
||||
pos = __curPos;
|
||||
expected = 0;
|
||||
actual = "meow";
|
||||
}
|
||||
{
|
||||
name = "snapshot-test";
|
||||
type = "snapshot";
|
||||
pos = __curPos;
|
||||
actual = "test";
|
||||
}
|
||||
{
|
||||
name = "test-snapshot-drv";
|
||||
type = "snapshot";
|
||||
pos = __curPos;
|
||||
actualDrv = pkgs.runCommand "test-snapshot" {} ''
|
||||
echo '"snapshot drv"' > $out
|
||||
'';
|
||||
}
|
||||
{
|
||||
name = "test-error-drv";
|
||||
pos = __curPos;
|
||||
expected = null;
|
||||
actualDrv = pkgs.runCommand "test-error-drv" {} ''
|
||||
exit 1
|
||||
'';
|
||||
}
|
||||
];
|
||||
"other-suite" = [
|
||||
{
|
||||
name = "obj-snapshot";
|
||||
type = "snapshot";
|
||||
pos = __curPos;
|
||||
actual = {hello = "world";};
|
||||
}
|
||||
{
|
||||
name = "test-drv";
|
||||
pos = __curPos;
|
||||
expected = {a = "b";};
|
||||
actualDrv = pkgs.runCommand "test-something" {} ''
|
||||
echo "Simulating taking some time"
|
||||
sleep 1
|
||||
echo '{"a":"b"}' > $out
|
||||
'';
|
||||
}
|
||||
{
|
||||
name = "skipped";
|
||||
pos = __curPos;
|
||||
expected = null;
|
||||
actual = null;
|
||||
}
|
||||
];
|
||||
};
|
||||
};
|
||||
|
||||
ci = {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue