Expose Node to npm lifecycle scripts
This commit is contained in:
@@ -14,6 +14,7 @@ class DeployerTests(unittest.TestCase):
|
||||
def test_process_output_accepts_utf8_and_gbk_without_decode_failure(self):
|
||||
output = []
|
||||
popen_options = {}
|
||||
npm = Path.cwd() / "fake-node" / "npm.cmd"
|
||||
|
||||
class FakeProcess:
|
||||
stdout = iter(
|
||||
@@ -32,7 +33,7 @@ class DeployerTests(unittest.TestCase):
|
||||
|
||||
with patch.object(deployer_module.subprocess, "Popen", side_effect=fake_popen):
|
||||
exit_code = deployer_module._run_process(
|
||||
["npm.cmd", "install"],
|
||||
[str(npm), "install"],
|
||||
Path("C:/project/web"),
|
||||
output.append,
|
||||
)
|
||||
@@ -40,6 +41,10 @@ class DeployerTests(unittest.TestCase):
|
||||
self.assertEqual(exit_code, 1)
|
||||
self.assertEqual(output, ["npm ERR! ⚠ dependency failed", "安装失败"])
|
||||
self.assertNotIn("text", popen_options)
|
||||
self.assertEqual(
|
||||
Path(popen_options["env"]["PATH"].split(os.pathsep)[0]),
|
||||
npm.parent,
|
||||
)
|
||||
|
||||
def test_frozen_app_reuses_executable_for_service_console(self):
|
||||
with patch.object(deployer_module.sys, "frozen", True, create=True):
|
||||
|
||||
Reference in New Issue
Block a user