From cf8a4723bcc84fefa8a2dd7ced63c180125b2843 Mon Sep 17 00:00:00 2001 From: Victor Engmark Date: Thu, 2 Nov 2023 20:43:20 +1300 Subject: [PATCH] nixos: test programs.npm.npmrc setting --- nixos/tests/all-tests.nix | 1 + nixos/tests/npmrc.nix | 22 ++++++++++++++++++++++ 2 files changed, 23 insertions(+) create mode 100644 nixos/tests/npmrc.nix diff --git a/nixos/tests/all-tests.nix b/nixos/tests/all-tests.nix index f7f8ac8fec88..2b2f1e204059 100644 --- a/nixos/tests/all-tests.nix +++ b/nixos/tests/all-tests.nix @@ -595,6 +595,7 @@ in { noto-fonts = handleTest ./noto-fonts.nix {}; noto-fonts-cjk-qt-default-weight = handleTest ./noto-fonts-cjk-qt-default-weight.nix {}; novacomd = handleTestOn ["x86_64-linux"] ./novacomd.nix {}; + npmrc = handleTest ./npmrc.nix {}; nscd = handleTest ./nscd.nix {}; nsd = handleTest ./nsd.nix {}; ntfy-sh = handleTest ./ntfy-sh.nix {}; diff --git a/nixos/tests/npmrc.nix b/nixos/tests/npmrc.nix new file mode 100644 index 000000000000..dbf24d372feb --- /dev/null +++ b/nixos/tests/npmrc.nix @@ -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" + ''; +})