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
|
|
@ -14,27 +14,39 @@ in {
|
|||
}: let
|
||||
nixtests-lib = import ./. {inherit pkgs self;};
|
||||
in {
|
||||
options.testSuites = mkOption {
|
||||
type = types.attrsOf (types.listOf types.attrs);
|
||||
options.nixtest = mkOption {
|
||||
type = types.submodule ({...}: {
|
||||
options = {
|
||||
skip = mkOption {
|
||||
type = types.str;
|
||||
default = "";
|
||||
description = "Which tests to skip (regex)";
|
||||
};
|
||||
suites = mkOption {
|
||||
type = types.attrsOf (types.listOf types.attrs);
|
||||
default = {};
|
||||
};
|
||||
};
|
||||
});
|
||||
default = {};
|
||||
};
|
||||
|
||||
config.legacyPackages = rec {
|
||||
"nixtests" = let
|
||||
suites = map (suiteName: let
|
||||
tests = builtins.getAttr suiteName config.testSuites;
|
||||
tests = builtins.getAttr suiteName config.nixtest.suites;
|
||||
in
|
||||
nixtests-lib.mkSuite
|
||||
suiteName
|
||||
(map (test: nixtests-lib.mkTest test) tests))
|
||||
(builtins.attrNames config.testSuites);
|
||||
(builtins.attrNames config.nixtest.suites);
|
||||
in
|
||||
nixtests-lib.exportSuites suites;
|
||||
"nixtests:run" = let
|
||||
program = pkgs.callPackage ./../package.nix {};
|
||||
in
|
||||
pkgs.writeShellScriptBin "nixtests:run" ''
|
||||
${program}/bin/nixtest --tests=${nixtests} "$@"
|
||||
${program}/bin/nixtest --tests=${nixtests} --skip="${config.nixtest.skip}" "$@"
|
||||
'';
|
||||
};
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue