@@ -26,6 +26,9 @@ describe("install procedure", () => {
26
26
let setOutputMock : jest . Mock ;
27
27
let restoreMATLABMock : jest . Mock ;
28
28
29
+ const runnerEnv = "github-hosted" ;
30
+ const agentIsSelfHosted = "0" ;
31
+
29
32
const platform = "linux" ;
30
33
const arch = "x64" ;
31
34
const release = "latest" ;
@@ -57,6 +60,9 @@ describe("install procedure", () => {
57
60
} ) ;
58
61
matlabGetReleaseInfoMock . mockResolvedValue ( releaseInfo ) ;
59
62
matlabGetToolcacheDirMock . mockResolvedValue ( [ "/opt/hostedtoolcache/MATLAB/9.13.0/x64" , false ] ) ;
63
+
64
+ process . env [ "RUNNER_ENVIRONMENT" ] = runnerEnv ;
65
+ process . env [ "AGENT_ISSELFHOSTED" ] = agentIsSelfHosted ;
60
66
} ) ;
61
67
62
68
it ( "ideally works" , async ( ) => {
@@ -91,6 +97,17 @@ describe("install procedure", () => {
91
97
await expect ( doInstall ( ) ) . rejects . toBeDefined ( ) ;
92
98
} ) ;
93
99
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
+
94
111
it ( "rejects when the setup deps fails" , async ( ) => {
95
112
matlabInstallSystemDependenciesMock . mockRejectedValueOnce ( Error ( "oof" ) ) ;
96
113
await expect ( doInstall ( ) ) . rejects . toBeDefined ( ) ;
0 commit comments