File tree Expand file tree Collapse file tree 4 files changed +11
-8
lines changed Expand file tree Collapse file tree 4 files changed +11
-8
lines changed Original file line number Diff line number Diff line change @@ -43,7 +43,7 @@ describe("installer tests", () => {
43
43
} ) ;
44
44
45
45
it ( "Downloads version of arduino-lint if no matching version is installed" , async ( ) => {
46
- await installer . getArduinoLint ( "0.4.0" ) ;
46
+ const toolPath = await installer . getArduinoLint ( "0.4.0" ) ;
47
47
const bindir = path . join (
48
48
toolDir ,
49
49
"arduino-lint" ,
@@ -52,6 +52,7 @@ describe("installer tests", () => {
52
52
"arduino-lint"
53
53
) ;
54
54
55
+ expect ( toolPath == path . join ( bindir , "arduino-lint" ) ) . toBe ( true ) ;
55
56
expect ( fs . existsSync ( `${ bindir } .complete` ) ) . toBe ( true ) ;
56
57
57
58
if ( IS_WINDOWS ) {
Original file line number Diff line number Diff line change @@ -80,7 +80,7 @@ function getArduinoLint(version) {
80
80
toolPath = yield downloadRelease ( version ) ;
81
81
core . debug ( "arduino-lint cached under " + toolPath ) ;
82
82
}
83
- core . addPath ( ` ${ toolPath } / arduino-lint` ) ;
83
+ return path . join ( toolPath , " arduino-lint" ) ;
84
84
} ) ;
85
85
}
86
86
exports . getArduinoLint = getArduinoLint ;
@@ -272,8 +272,9 @@ function run() {
272
272
const reportFile = core . getInput ( "report-file" ) ;
273
273
const verbose = core . getInput ( "verbose" ) ;
274
274
const official = core . getInput ( "official" ) ;
275
+ let toolPath = "arduino-lint" ;
275
276
if ( version ) {
276
- yield installer . getArduinoLint ( version ) ;
277
+ toolPath = yield installer . getArduinoLint ( version ) ;
277
278
}
278
279
const execArgs = [
279
280
"--compliance" ,
@@ -303,7 +304,7 @@ function run() {
303
304
ARDUINO_LINT_OFFICIAL : official ,
304
305
} ,
305
306
} ;
306
- yield exec . exec ( "arduino-lint" , execArgs , options ) ;
307
+ yield exec . exec ( toolPath , execArgs , options ) ;
307
308
}
308
309
catch ( error ) {
309
310
core . setFailed ( error . message ) ;
Original file line number Diff line number Diff line change @@ -33,7 +33,7 @@ interface ITaskRef {
33
33
ref : string ;
34
34
}
35
35
36
- export async function getArduinoLint ( version : string ) {
36
+ export async function getArduinoLint ( version : string ) : Promise < string > {
37
37
// resolve the version number
38
38
const targetVersion = await computeVersion ( version ) ;
39
39
if ( targetVersion ) {
@@ -50,7 +50,7 @@ export async function getArduinoLint(version: string) {
50
50
core . debug ( "arduino-lint cached under " + toolPath ) ;
51
51
}
52
52
53
- core . addPath ( ` ${ toolPath } / arduino-lint` ) ;
53
+ return path . join ( toolPath , " arduino-lint" ) ;
54
54
}
55
55
56
56
async function downloadRelease ( version : string ) : Promise < string > {
Original file line number Diff line number Diff line change @@ -14,8 +14,9 @@ async function run() {
14
14
const verbose = core . getInput ( "verbose" ) ;
15
15
const official = core . getInput ( "official" ) ;
16
16
17
+ let toolPath = "arduino-lint" ;
17
18
if ( version ) {
18
- await installer . getArduinoLint ( version ) ;
19
+ toolPath = await installer . getArduinoLint ( version ) ;
19
20
}
20
21
21
22
const execArgs = [
@@ -53,7 +54,7 @@ async function run() {
53
54
} ,
54
55
} ;
55
56
56
- await exec . exec ( "arduino-lint" , execArgs , options ) ;
57
+ await exec . exec ( toolPath , execArgs , options ) ;
57
58
} catch ( error ) {
58
59
core . setFailed ( error . message ) ;
59
60
}
You can’t perform that action at this time.
0 commit comments