Install project-compatible Node.js version
This commit is contained in:
@@ -50,6 +50,25 @@ class EnvironmentTests(unittest.TestCase):
|
||||
self.assertEqual(results[0].source, "手动指定")
|
||||
self.assertEqual(results[0].command[0], str(mysql))
|
||||
|
||||
def test_prefers_configured_node_version_over_another_path_version(self):
|
||||
with tempfile.TemporaryDirectory() as tmp:
|
||||
node = Path(tmp) / "node.exe"
|
||||
node.write_text("", encoding="utf-8")
|
||||
|
||||
def runner(command):
|
||||
version = "v16.20.2" if command[0] == str(node) else "v22.0.0"
|
||||
return subprocess.CompletedProcess(command, 0, version, "")
|
||||
|
||||
results = check_environment(
|
||||
runner=runner,
|
||||
checks={"Node.js": ["node", "--version"]},
|
||||
manual_paths={"Node.js": node},
|
||||
)
|
||||
|
||||
self.assertEqual(results[0].source, "手动指定")
|
||||
self.assertEqual(results[0].command[0], str(node))
|
||||
self.assertEqual(results[0].version, "v16.20.2")
|
||||
|
||||
def test_discovers_executable_from_known_search_paths(self):
|
||||
with tempfile.TemporaryDirectory() as tmp:
|
||||
mysql = Path(tmp) / "MySQL" / "MySQL Server 8.4" / "bin" / "mysql.exe"
|
||||
|
||||
Reference in New Issue
Block a user