From 55a453935fe6e3c62a9af5f4ff30ccc4a6de35b8 Mon Sep 17 00:00:00 2001 From: IvanZosimov Date: Mon, 3 Apr 2023 16:43:33 +0200 Subject: [PATCH] Format and Lint code --- .../distributors/local-installer.test.ts | 28 +++++++++++++++---- src/distributions/local/installer.ts | 7 +++-- 2 files changed, 27 insertions(+), 8 deletions(-) diff --git a/__tests__/distributors/local-installer.test.ts b/__tests__/distributors/local-installer.test.ts index 825ea983..8e9d5d43 100644 --- a/__tests__/distributors/local-installer.test.ts +++ b/__tests__/distributors/local-installer.test.ts @@ -224,9 +224,15 @@ describe('setupJava', () => { const jdkFile = 'not_existing_one'; const expected = { version: actualJavaVersion, - path: path.join('Java_jdkfile_jdk', inputs.version, inputs.architecture, 'Contents', 'Home') + path: path.join( + 'Java_jdkfile_jdk', + inputs.version, + inputs.architecture, + 'Contents', + 'Home' + ) }; - let originalPlatform = process.platform; + const originalPlatform = process.platform; Object.defineProperty(process, 'platform', { value: 'darwin' }); @@ -239,7 +245,9 @@ describe('setupJava', () => { mockJavaBase = new LocalDistribution(inputs, jdkFile); await expect(mockJavaBase.setupJava()).resolves.toEqual(expected); expect(spyGetToolcachePath).toHaveBeenCalled(); - expect(spyCoreInfo).toHaveBeenCalledWith(`Resolved Java ${actualJavaVersion} from tool-cache`); + expect(spyCoreInfo).toHaveBeenCalledWith( + `Resolved Java ${actualJavaVersion} from tool-cache` + ); expect(spyCoreInfo).not.toHaveBeenCalledWith( `Java ${inputs.version} was not found in tool-cache. Trying to unpack JDK file...` ); @@ -259,9 +267,15 @@ describe('setupJava', () => { const jdkFile = expectedJdkFile; const expected = { version: '11.0.289', - path: path.join('Java_jdkfile_jdk', inputs.version, inputs.architecture, 'Contents', 'Home') + path: path.join( + 'Java_jdkfile_jdk', + inputs.version, + inputs.architecture, + 'Contents', + 'Home' + ) }; - let originalPlatform = process.platform; + const originalPlatform = process.platform; Object.defineProperty(process, 'platform', { value: 'darwin' }); @@ -276,7 +290,9 @@ describe('setupJava', () => { expect(spyCoreInfo).not.toHaveBeenCalledWith( `Resolved Java ${actualJavaVersion} from tool-cache` ); - expect(spyCoreInfo).toHaveBeenCalledWith(`Extracting Java from '${jdkFile}'`); + expect(spyCoreInfo).toHaveBeenCalledWith( + `Extracting Java from '${jdkFile}'` + ); expect(spyCoreInfo).toHaveBeenCalledWith( `Java ${inputs.version} was not found in tool-cache. Trying to unpack JDK file...` ); diff --git a/src/distributions/local/installer.ts b/src/distributions/local/installer.ts index 82826064..adfac499 100644 --- a/src/distributions/local/installer.ts +++ b/src/distributions/local/installer.ts @@ -47,7 +47,7 @@ export class LocalDistribution extends JavaBase { const archivePath = path.join(extractedJavaPath, archiveName); const javaVersion = this.version; - let javaPath = await tc.cacheDir( + const javaPath = await tc.cacheDir( archivePath, this.toolcacheFolderName, this.getToolcacheVersionName(javaVersion), @@ -61,7 +61,10 @@ export class LocalDistribution extends JavaBase { } // JDK folder may contain postfix "Contents/Home" on macOS - const macOSPostfixPath = path.join(foundJava.path, MACOS_JAVA_CONTENT_POSTFIX); + const macOSPostfixPath = path.join( + foundJava.path, + MACOS_JAVA_CONTENT_POSTFIX + ); if (process.platform === 'darwin' && fs.existsSync(macOSPostfixPath)) { foundJava.path = macOSPostfixPath; }