fix(qmd): treat a missing global npm prefix as not installed

On a machine where no global npm package was ever installed, the global
prefix directory does not exist and `npm list --global --json` reports
ENOENT without a dependency list. QMD setup treated that as an unreliable
listing and failed the install/update. It now means the package is not
installed; other unreliable listings still fail.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Julian LechnerandClaude Opus 5.5 committed 2026-11-05 11:08:51 +01:00
1 parent b6fd4dde7d
commit a89be2604b
2 files changed
+10

No files matched your search

+5
View File
@@ -220,6 +220,11 @@ class SetupTest(unittest.TestCase):
self.assertTrue(self.setup(FakeRunner(list_output='{"dependencies": {"@tobilu/qmd": {}}, "error": {}}')).package_installed())
self.assertFalse(self.setup(FakeRunner(list_output='{"dependencies": {}}')).package_installed())
def test_package_installed_treats_missing_global_prefix_as_not_installed(self):
# npm reports ENOENT for the global prefix before anything was ever installed globally.
output = '{"error": {"code": "ENOENT", "summary": "ENOENT: no such file or directory, lstat \'C:\\\\Users\\\\me\\\\AppData\\\\Roaming\\\\npm\'"}}'
self.assertFalse(self.setup(FakeRunner(list_output=output)).package_installed())
def test_non_mapping_previous_models_are_restored_verbatim(self):
runner = FakeRunner(previous='custom.gguf')
setup = self.setup(runner)