File tree Expand file tree Collapse file tree 2 files changed +26
-3
lines changed
packages/cli-doctor/src/tools/healthchecks Expand file tree Collapse file tree 2 files changed +26
-3
lines changed Original file line number Diff line number Diff line change @@ -75,6 +75,29 @@ describe('androidSDK', () => {
75
75
expect ( diagnostics . needsToBeFixed ) . toBe ( true ) ;
76
76
} ) ;
77
77
78
+ it ( 'reads buildToolsVersion when using more complex definition' , async ( ) => {
79
+ // Override mock file
80
+ writeFiles ( mockWorkingDir , {
81
+ 'android/build.gradle' : `
82
+ buildscript {
83
+ ext {
84
+ buildToolsVersion = findProperty('android.buildToolsVersion') ?: '34.0.0'
85
+ minSdkVersion = 16
86
+ compileSdkVersion = 28
87
+ targetSdkVersion = 28
88
+ }
89
+ }
90
+ ` ,
91
+ } ) ;
92
+ // @ts -ignore
93
+ environmentInfo . SDKs [ 'Android SDK' ] = {
94
+ 'Build Tools' : [ '34.0.0' ] ,
95
+ } ;
96
+ ( execa as unknown as jest . Mock ) . mockResolvedValue ( { stdout : '' } ) ;
97
+ const diagnostics = await androidSDK . getDiagnostics ( environmentInfo ) ;
98
+ expect ( diagnostics . needsToBeFixed ) . toBe ( false ) ;
99
+ } ) ;
100
+
78
101
it ( 'returns false if the SDK version is in range' , async ( ) => {
79
102
// To avoid having to provide fake versions for all the Android SDK tools
80
103
// @ts -ignore
Original file line number Diff line number Diff line change @@ -49,9 +49,9 @@ const getBuildToolsVersion = (projectRoot = ''): string => {
49
49
// Get only the portion of the declaration of `buildToolsVersion`
50
50
. substring ( buildToolsVersionIndex )
51
51
. split ( '\n' ) [ 0 ]
52
- // Get only the the value of `buildToolsVersion`
53
- . match ( / \d | \. . / g) || [ ]
54
- ) . join ( '' ) ;
52
+ // Get only the value of `buildToolsVersion`
53
+ . match ( / \d + \. \d + \. \d + / g) || [ ]
54
+ ) . at ( 0 ) ;
55
55
56
56
return buildToolsVersion || 'Not Found' ;
57
57
} ;
You can’t perform that action at this time.
0 commit comments