@@ -26,6 +26,9 @@ describe("install procedure", () => {
2626 let setOutputMock : jest . Mock ;
2727 let restoreMATLABMock : jest . Mock ;
2828
29+ const runnerEnv = "github-hosted" ;
30+ const agentIsSelfHosted = "0" ;
31+
2932 const platform = "linux" ;
3033 const arch = "x64" ;
3134 const release = "latest" ;
@@ -57,6 +60,9 @@ describe("install procedure", () => {
5760 } ) ;
5861 matlabGetReleaseInfoMock . mockResolvedValue ( releaseInfo ) ;
5962 matlabGetToolcacheDirMock . mockResolvedValue ( [ "/opt/hostedtoolcache/MATLAB/9.13.0/x64" , false ] ) ;
63+
64+ process . env [ "RUNNER_ENVIRONMENT" ] = runnerEnv ;
65+ process . env [ "AGENT_ISSELFHOSTED" ] = agentIsSelfHosted ;
6066 } ) ;
6167
6268 it ( "ideally works" , async ( ) => {
@@ -91,6 +97,17 @@ describe("install procedure", () => {
9197 await expect ( doInstall ( ) ) . rejects . toBeDefined ( ) ;
9298 } ) ;
9399
100+ it ( "sets up dependencies for github-hosted runners" , async ( ) => {
101+ await doInstall ( ) ;
102+ expect ( matlabInstallSystemDependenciesMock ) . toHaveBeenCalled ( ) ;
103+ } ) ;
104+
105+ it ( "does not set up dependencies for self-hosted runners" , async ( ) => {
106+ process . env [ "RUNNER_ENVIRONMENT" ] = "self-hosted" ;
107+ await doInstall ( ) ;
108+ expect ( matlabInstallSystemDependenciesMock ) . not . toHaveBeenCalled ( ) ;
109+ } ) ;
110+
94111 it ( "rejects when the setup deps fails" , async ( ) => {
95112 matlabInstallSystemDependenciesMock . mockRejectedValueOnce ( Error ( "oof" ) ) ;
96113 await expect ( doInstall ( ) ) . rejects . toBeDefined ( ) ;
0 commit comments