Merge pull request #264966 from l0b0/test/verify-npmrc-setup

nixos: test `programs.npm.npmrc` setting
This commit is contained in:
Pierre Bourdon 2023-12-18 07:06:14 +01:00 committed by GitHub
commit afa3f9b7c1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 23 additions and 0 deletions

View File

@ -606,6 +606,7 @@ in {
noto-fonts = handleTest ./noto-fonts.nix {}; noto-fonts = handleTest ./noto-fonts.nix {};
noto-fonts-cjk-qt-default-weight = handleTest ./noto-fonts-cjk-qt-default-weight.nix {}; noto-fonts-cjk-qt-default-weight = handleTest ./noto-fonts-cjk-qt-default-weight.nix {};
novacomd = handleTestOn ["x86_64-linux"] ./novacomd.nix {}; novacomd = handleTestOn ["x86_64-linux"] ./novacomd.nix {};
npmrc = handleTest ./npmrc.nix {};
nscd = handleTest ./nscd.nix {}; nscd = handleTest ./nscd.nix {};
nsd = handleTest ./nsd.nix {}; nsd = handleTest ./nsd.nix {};
ntfy-sh = handleTest ./ntfy-sh.nix {}; ntfy-sh = handleTest ./ntfy-sh.nix {};

22
nixos/tests/npmrc.nix Normal file
View File

@ -0,0 +1,22 @@
import ./make-test-python.nix ({ ... }:
let
machineName = "machine";
settingName = "prefix";
settingValue = "/some/path";
in
{
name = "npmrc";
nodes."${machineName}".programs.npm = {
enable = true;
npmrc = ''
${settingName} = ${settingValue}
'';
};
testScript = ''
${machineName}.start()
assert ${machineName}.succeed("npm config get ${settingName}") == "${settingValue}\n"
'';
})