@@ -27,7 +27,7 @@ suite(OmnisharpManager.name, () => {
2727 const latestfilePath = "latestPath" ;
2828 const installPath = "somePath" ;
2929 let tmpInstallDir : TmpAsset ;
30- let tmpInstallPath : string ;
30+ let extensionPath : string ;
3131 let tmpFile : TmpAsset ;
3232 let testZip : TestZip ;
3333
@@ -63,9 +63,8 @@ suite(OmnisharpManager.name, () => {
6363 server = await MockHttpsServer . CreateMockHttpsServer ( ) ;
6464 await server . start ( ) ;
6565 tmpInstallDir = await CreateTmpDir ( true ) ;
66- tmpInstallPath = tmpInstallDir . name ;
67- util . setExtensionPath ( tmpInstallPath ) ;
68- manager = GetTestOmniSharpManager ( elem . platformInfo , eventStream ) ;
66+ extensionPath = tmpInstallDir . name ;
67+ manager = GetTestOmniSharpManager ( elem . platformInfo , eventStream , extensionPath ) ;
6968 testZip = await TestZip . createTestZipAsync ( createTestFile ( "Foo" , "foo.txt" ) ) ;
7069 server . addRequestHandler ( 'GET' , `/releases/${ testVersion } /omnisharp-${ elem . platformId } .zip` , 200 , {
7170 "content-type" : "application/zip" ,
@@ -83,56 +82,56 @@ suite(OmnisharpManager.name, () => {
8382 } ) ;
8483
8584 test ( 'Throws error if the path is neither an absolute path nor a valid semver, nor the string "latest"' , async ( ) => {
86- expect ( manager . GetOmniSharpLaunchInfo ( defaultVersion , "Some incorrect path" , server . baseUrl , latestfilePath , installPath , tmpInstallPath ) ) . to . be . rejectedWith ( Error ) ;
85+ expect ( manager . GetOmniSharpLaunchInfo ( defaultVersion , "Some incorrect path" , server . baseUrl , latestfilePath , installPath , extensionPath ) ) . to . be . rejectedWith ( Error ) ;
8786 } ) ;
8887
8988 test ( 'Throws error when the specified path is an invalid semver' , async ( ) => {
90- expect ( manager . GetOmniSharpLaunchInfo ( defaultVersion , "a.b.c" , server . baseUrl , latestfilePath , installPath , tmpInstallPath ) ) . to . be . rejectedWith ( Error ) ;
89+ expect ( manager . GetOmniSharpLaunchInfo ( defaultVersion , "a.b.c" , server . baseUrl , latestfilePath , installPath , extensionPath ) ) . to . be . rejectedWith ( Error ) ;
9190 } ) ;
9291
9392 test ( 'Returns the same path if absolute path to an existing file is passed' , async ( ) => {
9493 tmpFile = await CreateTmpFile ( ) ;
95- let launchInfo = await manager . GetOmniSharpLaunchInfo ( defaultVersion , tmpFile . name , server . baseUrl , latestfilePath , installPath , tmpInstallPath ) ;
94+ let launchInfo = await manager . GetOmniSharpLaunchInfo ( defaultVersion , tmpFile . name , server . baseUrl , latestfilePath , installPath , extensionPath ) ;
9695 expect ( launchInfo . LaunchPath ) . to . be . equal ( tmpFile . name ) ;
9796 } ) ;
9897
9998 test ( 'Returns the default path if the omnisharp path is not set' , async ( ) => {
100- let launchInfo = await manager . GetOmniSharpLaunchInfo ( defaultVersion , "" , server . baseUrl , latestfilePath , installPath , tmpInstallPath ) ;
101- expect ( launchInfo . LaunchPath ) . to . be . equal ( path . join ( tmpInstallPath , ".omnisharp" , defaultVersion , elem . executable ) ) ;
99+ let launchInfo = await manager . GetOmniSharpLaunchInfo ( defaultVersion , "" , server . baseUrl , latestfilePath , installPath , extensionPath ) ;
100+ expect ( launchInfo . LaunchPath ) . to . be . equal ( path . join ( extensionPath , ".omnisharp" , defaultVersion , elem . executable ) ) ;
102101 if ( elem . platformInfo . isWindows ( ) ) {
103102 expect ( launchInfo . MonoLaunchPath ) . to . be . undefined ;
104103 }
105104 else {
106- expect ( launchInfo . MonoLaunchPath ) . to . be . equal ( path . join ( tmpInstallPath , ".omnisharp" , defaultVersion , "omnisharp" , "OmniSharp.exe" ) ) ;
105+ expect ( launchInfo . MonoLaunchPath ) . to . be . equal ( path . join ( extensionPath , ".omnisharp" , defaultVersion , "omnisharp" , "OmniSharp.exe" ) ) ;
107106 }
108107 } ) ;
109108
110109 test ( 'Installs the latest version and returns the launch path ' , async ( ) => {
111- let launchInfo = await manager . GetOmniSharpLaunchInfo ( defaultVersion , "latest" , server . baseUrl , latestfilePath , installPath , tmpInstallPath ) ;
112- expect ( launchInfo . LaunchPath ) . to . be . equal ( path . join ( tmpInstallPath , installPath , latestVersion , elem . executable ) ) ;
110+ let launchInfo = await manager . GetOmniSharpLaunchInfo ( defaultVersion , "latest" , server . baseUrl , latestfilePath , installPath , extensionPath ) ;
111+ expect ( launchInfo . LaunchPath ) . to . be . equal ( path . join ( extensionPath , installPath , latestVersion , elem . executable ) ) ;
113112 if ( elem . platformInfo . isWindows ( ) ) {
114113 expect ( launchInfo . MonoLaunchPath ) . to . be . undefined ;
115114 }
116115 else {
117- expect ( launchInfo . MonoLaunchPath ) . to . be . equal ( path . join ( tmpInstallPath , installPath , latestVersion , "omnisharp" , "OmniSharp.exe" ) ) ;
116+ expect ( launchInfo . MonoLaunchPath ) . to . be . equal ( path . join ( extensionPath , installPath , latestVersion , "omnisharp" , "OmniSharp.exe" ) ) ;
118117 }
119118 } ) ;
120119
121120 test ( 'Installs the test version and returns the launch path' , async ( ) => {
122- let launchInfo = await manager . GetOmniSharpLaunchInfo ( defaultVersion , testVersion , server . baseUrl , latestfilePath , installPath , tmpInstallPath ) ;
123- expect ( launchInfo . LaunchPath ) . to . be . equal ( path . join ( tmpInstallPath , installPath , testVersion , elem . executable ) ) ;
121+ let launchInfo = await manager . GetOmniSharpLaunchInfo ( defaultVersion , testVersion , server . baseUrl , latestfilePath , installPath , extensionPath ) ;
122+ expect ( launchInfo . LaunchPath ) . to . be . equal ( path . join ( extensionPath , installPath , testVersion , elem . executable ) ) ;
124123 if ( elem . platformInfo . isWindows ( ) ) {
125124 expect ( launchInfo . MonoLaunchPath ) . to . be . undefined ;
126125 }
127126 else {
128- expect ( launchInfo . MonoLaunchPath ) . to . be . equal ( path . join ( tmpInstallPath , installPath , testVersion , "omnisharp" , "OmniSharp.exe" ) ) ;
127+ expect ( launchInfo . MonoLaunchPath ) . to . be . equal ( path . join ( extensionPath , installPath , testVersion , "omnisharp" , "OmniSharp.exe" ) ) ;
129128 }
130129 } ) ;
131130
132131 test ( 'Downloads package from given url and installs them at the specified path' , async ( ) => {
133- await manager . GetOmniSharpLaunchInfo ( defaultVersion , testVersion , server . baseUrl , latestfilePath , installPath , tmpInstallPath ) ;
132+ await manager . GetOmniSharpLaunchInfo ( defaultVersion , testVersion , server . baseUrl , latestfilePath , installPath , extensionPath ) ;
134133 for ( let elem of testZip . files ) {
135- let filePath = path . join ( tmpInstallPath , installPath , testVersion , elem . path ) ;
134+ let filePath = path . join ( extensionPath , installPath , testVersion , elem . path ) ;
136135 expect ( await util . fileExists ( filePath ) ) . to . be . true ;
137136 }
138137 } ) ;
@@ -146,11 +145,11 @@ suite(OmnisharpManager.name, () => {
146145 tmpFile = undefined ;
147146 }
148147 tmpInstallDir . dispose ( ) ;
149- tmpInstallPath = undefined ;
148+ extensionPath = undefined ;
150149 } ) ;
151150} ) ;
152151
153- function GetTestOmniSharpManager ( platformInfo : PlatformInformation , eventStream : EventStream ) : OmnisharpManager {
154- let downloader = new OmnisharpDownloader ( ( ) => new NetworkSettings ( undefined , false ) , eventStream , testPackageJSON , platformInfo ) ;
152+ function GetTestOmniSharpManager ( platformInfo : PlatformInformation , eventStream : EventStream , extensionPath : string ) : OmnisharpManager {
153+ let downloader = new OmnisharpDownloader ( ( ) => new NetworkSettings ( undefined , false ) , eventStream , testPackageJSON , platformInfo , extensionPath ) ;
155154 return new OmnisharpManager ( downloader , platformInfo ) ;
156155}
0 commit comments