1
0
Fork 0
mirror of https://github.com/nix-community/home-manager.git synced 2025-12-20 07:51:10 +01:00
home-manager/tests/modules/programs/npm/example-settings.nix
2025-12-11 12:58:36 -06:00

36 lines
755 B
Nix

{ pkgs, ... }:
{
programs.npm = {
enable = true;
settings = {
color = true;
include = [
"dev"
"prod"
];
init-license = "MIT";
prefix = "\${HOME}/.npm";
};
};
test.stubs.nodejs = { };
nmt.script =
let
configPath = "home-files/.npmrc";
expectedConfig = pkgs.writeText "npmrc-expected" ''
color=true
include[]=dev
include[]=prod
init-license=MIT
prefix=''${HOME}/.npm
'';
in
''
assertFileExists "${configPath}"
assertFileContent "${configPath}" "${expectedConfig}"
assertFileContains home-path/etc/profile.d/hm-session-vars.sh \
'export NPM_CONFIG_USERCONFIG="/home/hm-user/.npmrc"'
'';
}