Skip to content

The agent that grows with you

test: Windows PATH .cmd preference applies to non-PM tools only

teknium1c274b9e9c900
diff --git a/tests/pm/test_node_resolution.py b/tests/pm/test_node_resolution.py
index 4922951eb49..7fd3465513e 100644
--- a/tests/pm/test_node_resolution.py
+++ b/tests/pm/test_node_resolution.py
@@ -169,12 +169,15 @@ def test_npm_and_npx_use_the_paired_pm_entry(node_store, monkeypatch):
@pytest.mark.platforms("windows")
-def test_windows_path_prefers_launchable_npm_cmd(tmp_path, monkeypatch):
+def test_windows_path_prefers_launchable_cmd_but_never_for_pm_tools(tmp_path, monkeypatch):
monkeypatch.setenv("HERMES_RUNTIME_DIR", str(tmp_path / "absent-store"))
monkeypatch.setenv("PATH", str(tmp_path))
- for name in ("npm", "npm.ps1", "npm.cmd"):
- (tmp_path / name).write_text("@exit /b 0\n", encoding="utf-8")
- assert hermes_constants.find_node_executable("npm") == str(tmp_path / "npm.cmd")
+ for tool in ("npm", "pnpm"):
+ for name in (tool, f"{tool}.ps1", f"{tool}.cmd"):
+ (tmp_path / name).write_text("@exit /b 0\n", encoding="utf-8")
+ # pnpm is an explicit user choice (lsp.package_manager); npm is only ever PM's.
+ assert hermes_constants.find_node_executable("pnpm") == str(tmp_path / "pnpm.cmd")
+ assert hermes_constants.find_node_executable("npm") is None
@pytest.fixture