dream2nix/tests/nix-unit/test_nodejs_node_builder_v3/default.nix
Johannes Kirschbauer a27d3894ae
Feat/group pkgs versions (#757)
* add derived graph

* rework graph sanitizing based on list keys

* figure out details for builder

* format stuff!

* try get groups working

* nodejs: fixups for new v3 builder

Co-authored-by: Johannes Kirschbauer <hsjobeki@gmail.com>

---------

Co-authored-by: DavHau <hsngrmpf+github@gmail.com>
2024-01-18 19:56:00 +07:00

80 lines
2.1 KiB
Nix

{
pkgs ? import <nixpkgs> {},
lib ? import <nixpkgs/lib>,
inputs ? {},
dream2nix ? import ../../.. inputs,
}: let
eval = module:
lib.evalModules {
modules = [module];
specialArgs = {
inherit dream2nix;
packageSets = {
nixpkgs = pkgs;
};
};
};
in {
test_nodejs_eval_dist = let
evaled = eval ({config, ...}: {
imports = [
dream2nix.modules.dream2nix.WIP-nodejs-builder-v3
];
WIP-nodejs-builder-v3.packageLockFile = ./package-lock.json;
});
config = evaled.config;
in {
expr = lib.generators.toPretty {} config.WIP-nodejs-builder-v3.pdefs."minimal"."1.0.0".dist;
expected = "<derivation minimal-dist>";
};
test_nodejs_eval_nodeModules = let
evaled = eval ({config, ...}: {
imports = [
dream2nix.modules.dream2nix.WIP-nodejs-builder-v3
];
WIP-nodejs-builder-v3.packageLockFile = ./package-lock.json;
});
config = evaled.config;
in {
expr = lib.generators.toPretty {} config.WIP-nodejs-builder-v3.pdefs."minimal"."1.0.0".prepared-dev;
expected = "<derivation minimal-node_modules-dev>";
};
test_nodejs_root_info = let
evaled = eval ({config, ...}: {
imports = [
dream2nix.modules.dream2nix.WIP-nodejs-builder-v3
];
WIP-nodejs-builder-v3.packageLockFile = ./package-lock.json;
});
config = evaled.config;
in {
expr = {
inherit
(config.WIP-nodejs-builder-v3.pdefs."minimal"."1.0.0".info)
initialPath
initialState
;
};
expected = {
initialPath = "";
initialState = "source";
};
};
# TODO: There is no prod node_modules yet.
test_nodejs_eval_nodeModules_prod = let
evaled = eval ({config, ...}: {
imports = [
dream2nix.modules.dream2nix.WIP-nodejs-builder-v3
];
WIP-nodejs-builder-v3.packageLockFile = ./package-lock.json;
});
config = evaled.config;
in {
expr = lib.generators.toPretty {} config.WIP-nodejs-builder-v3.pdefs."minimal"."1.0.0".prepared-prod;
expected = "<derivation minimal-node_modules-prod>";
};
}