@@ -8,7 +8,11 @@ import { ChildProcess } from "../lib/wrappers/child-process";
8
8
const JavaHomeName = "JAVA_HOME" ;
9
9
const AndroidHomeName = "ANDROID_HOME" ;
10
10
const PROGRAM_FILES = "ProgramFiles" ;
11
+ const PROGRAM_FILES_X86 = "ProgramFiles(x86)" ;
12
+ const LOCAL_APP_DATA = "LOCALAPPDATA" ;
11
13
const PROGRAM_FILES_ENV_PATH = "C:\\Program Files" ;
14
+ const PROGRAM_FILEX_X86_ENV_PATH = "C:\\Program Files(x86)" ;
15
+ const LOCAL_APP_DATA_ENV_PATH = "C:\\username\\localappdata" ;
12
16
13
17
interface IChildProcessResultDescription {
14
18
result ?: any ;
@@ -145,7 +149,7 @@ function mockSysInfo(childProcessResult: IChildProcessResults, hostInfoOptions?:
145
149
} ;
146
150
147
151
const fileSystem : any = {
148
- exists : ( ) => Promise . resolve ( ( fileSystemOptions || { } ) . existsResult ) ,
152
+ exists : ( ) => ( fileSystemOptions || { } ) . existsResult ,
149
153
extractZip : ( ) => Promise . resolve ( ) ,
150
154
readDirectory : ( ) => Promise . resolve ( [ ] )
151
155
} ;
@@ -271,7 +275,9 @@ describe("SysInfo unit tests", () => {
271
275
it ( "on Windows" , async ( ) => {
272
276
const originalProgramFiles = process . env [ PROGRAM_FILES ] ;
273
277
process . env [ PROGRAM_FILES ] = PROGRAM_FILES_ENV_PATH ;
274
- sysInfo = mockSysInfo ( childProcessResult , { isWindows : true , isDarwin : false , dotNetVersion } ) ;
278
+ process . env [ PROGRAM_FILES_X86 ] = PROGRAM_FILEX_X86_ENV_PATH ;
279
+ process . env [ LOCAL_APP_DATA ] = LOCAL_APP_DATA_ENV_PATH ;
280
+ sysInfo = mockSysInfo ( childProcessResult , { isWindows : true , isDarwin : false , dotNetVersion } , { existsResult : true } ) ;
275
281
const result = await sysInfo . getSysInfo ( ) ;
276
282
process . env [ PROGRAM_FILES ] = originalProgramFiles ;
277
283
assertCommonValues ( result ) ;
@@ -517,7 +523,7 @@ ${expectedCliVersion}`;
517
523
assert . deepEqual ( result . itunesInstalled , undefined ) ;
518
524
assert . deepEqual ( result . cocoaPodsVer , "0.38.2" ) ;
519
525
assert . deepEqual ( result . xcodeprojLocation , null ) ;
520
- assert . deepEqual ( result . isCocoaPodsWorkingCorrectly , undefined ) ;
526
+ assert . deepEqual ( result . isCocoaPodsWorkingCorrectly , true ) ;
521
527
assert . deepEqual ( result . xcprojInfo , undefined ) ;
522
528
assert . deepEqual ( result . isCocoaPodsUpdateRequired , false ) ;
523
529
assert . deepEqual ( result . pythonInfo , { isInstalled : false , isSixPackageInstalled : false , installationErrorMessage : "Cannot read property 'shouldThrowError' of undefined" } ) ;
@@ -538,7 +544,7 @@ ${expectedCliVersion}`;
538
544
assert . deepEqual ( result . isAndroidSdkConfiguredCorrectly , undefined ) ;
539
545
} ) ;
540
546
it ( "Android platform is specified" , async ( ) => {
541
- sysInfo = mockSysInfo ( childProcessResult , { isWindows : false , isDarwin : true , dotNetVersion } ) ;
547
+ sysInfo = mockSysInfo ( childProcessResult , { isWindows : false , isDarwin : true , dotNetVersion } , { existsResult : true } ) ;
542
548
const result = await sysInfo . getSysInfo ( { platform : "Android" } ) ;
543
549
544
550
assertCommonSysInfo ( result ) ;
@@ -552,7 +558,6 @@ ${expectedCliVersion}`;
552
558
assert . deepEqual ( result . xcprojInfo , undefined ) ;
553
559
assert . deepEqual ( result . isCocoaPodsUpdateRequired , undefined ) ;
554
560
assert . deepEqual ( result . pythonInfo , undefined ) ;
555
-
556
561
} ) ;
557
562
it ( "no platform is specified" , async ( ) => {
558
563
sysInfo = mockSysInfo ( childProcessResult , { isWindows : false , isDarwin : true , dotNetVersion } ) ;
0 commit comments