@@ -31,6 +31,8 @@ def test_dependencies_check_returns_false(self):
3131 )
3232 assert step .check (ctx ) is False
3333
34+ @patch ("installer.steps.dependencies.install_golangci_lint" , return_value = True )
35+ @patch ("installer.steps.dependencies.install_prettier" , return_value = True )
3436 @patch ("installer.steps.dependencies._precache_npx_mcp_servers" , return_value = True )
3537 @patch ("installer.steps.dependencies.install_vexor" )
3638 @patch ("installer.steps.dependencies._install_plugin_dependencies" )
@@ -49,6 +51,8 @@ def test_dependencies_run_installs_core(
4951 mock_plugin_deps ,
5052 mock_vexor ,
5153 _mock_precache ,
54+ _mock_prettier ,
55+ _mock_golangci_lint ,
5256 ):
5357 """DependenciesStep installs all dependencies including Python tools."""
5458 from installer .context import InstallContext
@@ -769,3 +773,110 @@ def test_install_vexor_routes_to_mlx_on_macos_arm64(self, _mock_platform, mock_m
769773
770774 assert result is True
771775 mock_mlx .assert_called_once ()
776+
777+
778+ class TestInstallPrettier :
779+ """Test prettier global installation."""
780+
781+ def test_install_prettier_exists (self ):
782+ """install_prettier function exists."""
783+ from installer .steps .dependencies import install_prettier
784+
785+ assert callable (install_prettier )
786+
787+ @patch ("installer.steps.dependencies.command_exists" , return_value = True )
788+ def test_install_prettier_skips_if_already_installed (self , _mock_cmd ):
789+ """install_prettier returns True without installing when prettier is in PATH."""
790+ from installer .steps .dependencies import install_prettier
791+
792+ with patch ("installer.steps.dependencies._run_bash_with_retry" ) as mock_run :
793+ result = install_prettier ()
794+
795+ assert result is True
796+ mock_run .assert_not_called ()
797+
798+ @patch ("installer.steps.dependencies._run_bash_with_retry" , return_value = True )
799+ @patch ("installer.steps.dependencies.command_exists" , return_value = False )
800+ def test_install_prettier_installs_via_npm (self , _mock_cmd , mock_run ):
801+ """install_prettier uses npm install -g prettier when not in PATH."""
802+ from installer .steps .dependencies import install_prettier
803+
804+ result = install_prettier ()
805+
806+ assert result is True
807+ mock_run .assert_called_once ()
808+ assert "prettier" in mock_run .call_args [0 ][0 ]
809+ assert "npm install -g" in mock_run .call_args [0 ][0 ]
810+
811+ @patch ("installer.steps.dependencies._run_bash_with_retry" , return_value = False )
812+ @patch ("installer.steps.dependencies.command_exists" , return_value = False )
813+ def test_install_prettier_returns_false_on_failure (self , _mock_cmd , mock_run ):
814+ """install_prettier returns False when npm install fails."""
815+ from installer .steps .dependencies import install_prettier
816+
817+ result = install_prettier ()
818+
819+ assert result is False
820+
821+
822+ class TestInstallGolangciLint :
823+ """Test golangci-lint installation."""
824+
825+ def test_install_golangci_lint_exists (self ):
826+ """install_golangci_lint function exists."""
827+ from installer .steps .dependencies import install_golangci_lint
828+
829+ assert callable (install_golangci_lint )
830+
831+ @patch ("installer.steps.dependencies.command_exists" , return_value = True )
832+ def test_install_golangci_lint_skips_if_already_installed (self , mock_cmd ):
833+ """install_golangci_lint returns True without installing when already in PATH."""
834+ from installer .steps .dependencies import install_golangci_lint
835+
836+ with patch ("installer.steps.dependencies._run_bash_with_retry" ) as mock_run :
837+ result = install_golangci_lint ()
838+
839+ assert result is True
840+ mock_run .assert_not_called ()
841+
842+ @patch ("installer.steps.dependencies.command_exists" )
843+ def test_install_golangci_lint_skips_without_go (self , mock_cmd ):
844+ """install_golangci_lint returns False when go is not installed."""
845+ from installer .steps .dependencies import install_golangci_lint
846+
847+ mock_cmd .side_effect = lambda cmd : cmd != "golangci-lint" and False
848+
849+ with patch ("installer.steps.dependencies._run_bash_with_retry" ) as mock_run :
850+ result = install_golangci_lint ()
851+
852+ assert result is False
853+ mock_run .assert_not_called ()
854+
855+ @patch ("installer.steps.dependencies._run_bash_with_retry" , return_value = True )
856+ @patch ("installer.steps.dependencies.command_exists" )
857+ def test_install_golangci_lint_uses_official_script (self , mock_cmd , mock_run ):
858+ """install_golangci_lint uses the official install.sh script."""
859+ from installer .steps .dependencies import install_golangci_lint
860+
861+ mock_cmd .side_effect = lambda cmd : cmd == "go"
862+
863+ result = install_golangci_lint ()
864+
865+ assert result is True
866+ mock_run .assert_called_once ()
867+ call_args = mock_run .call_args [0 ][0 ]
868+ assert "golangci-lint" in call_args
869+ assert "install.sh" in call_args
870+ assert "go env GOPATH" in call_args
871+
872+ @patch ("installer.steps.dependencies._run_bash_with_retry" , return_value = False )
873+ @patch ("installer.steps.dependencies.command_exists" )
874+ def test_install_golangci_lint_returns_false_on_failure (self , mock_cmd , mock_run ):
875+ """install_golangci_lint returns False when install script fails."""
876+ from installer .steps .dependencies import install_golangci_lint
877+
878+ mock_cmd .side_effect = lambda cmd : cmd == "go"
879+
880+ result = install_golangci_lint ()
881+
882+ assert result is False
0 commit comments