mirror of
https://gitlab.com/TECHNOFAB/nixtest.git
synced 2025-12-12 02:00:18 +01:00
feat: remove nix store path prefix if used in flakeModule
This commit is contained in:
parent
27696c02bc
commit
482f15c486
2 changed files with 12 additions and 4 deletions
|
|
@ -1,4 +1,9 @@
|
||||||
{pkgs, ...}: {
|
{
|
||||||
|
pkgs,
|
||||||
|
lib ? pkgs.lib,
|
||||||
|
self ? "",
|
||||||
|
...
|
||||||
|
}: {
|
||||||
mkTest = {
|
mkTest = {
|
||||||
type ? "unit",
|
type ? "unit",
|
||||||
name,
|
name,
|
||||||
|
|
@ -7,13 +12,15 @@
|
||||||
actual ? null,
|
actual ? null,
|
||||||
actualDrv ? null,
|
actualDrv ? null,
|
||||||
pos ? null,
|
pos ? null,
|
||||||
}: {
|
}: let
|
||||||
|
fileRelative = lib.removePrefix ((toString self) + "/") pos.file;
|
||||||
|
in {
|
||||||
inherit type name description expected actual;
|
inherit type name description expected actual;
|
||||||
actualDrv = actualDrv.drvPath or "";
|
actualDrv = actualDrv.drvPath or "";
|
||||||
pos =
|
pos =
|
||||||
if pos == null
|
if pos == null
|
||||||
then ""
|
then ""
|
||||||
else "${pos.file}:${toString pos.line}:${toString pos.column}";
|
else "${fileRelative}:${toString pos.line}:${toString pos.column}";
|
||||||
};
|
};
|
||||||
mkSuite = name: tests: {
|
mkSuite = name: tests: {
|
||||||
inherit name tests;
|
inherit name tests;
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,7 @@
|
||||||
{
|
{
|
||||||
flake-parts-lib,
|
flake-parts-lib,
|
||||||
lib,
|
lib,
|
||||||
|
self,
|
||||||
...
|
...
|
||||||
}: let
|
}: let
|
||||||
inherit (lib) mkOption types;
|
inherit (lib) mkOption types;
|
||||||
|
|
@ -11,7 +12,7 @@ in {
|
||||||
pkgs,
|
pkgs,
|
||||||
...
|
...
|
||||||
}: let
|
}: let
|
||||||
nixtests-lib = import ./. {inherit pkgs;};
|
nixtests-lib = import ./. {inherit pkgs self;};
|
||||||
in {
|
in {
|
||||||
options.testSuites = mkOption {
|
options.testSuites = mkOption {
|
||||||
type = types.attrsOf (types.listOf types.attrs);
|
type = types.attrsOf (types.listOf types.attrs);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue