diff --git a/__tests__/nightly-installer.test.ts b/__tests__/nightly-installer.test.ts index c794e8df..10c3972a 100644 --- a/__tests__/nightly-installer.test.ts +++ b/__tests__/nightly-installer.test.ts @@ -670,7 +670,6 @@ describe('NightlyNodejs', () => { ); }); - const core = require('@actions/core'); // Mock core jest.spyOn(core, 'info').mockImplementation(() => {}); // Mock core.info function it('logs mirror URL when provided', async () => { diff --git a/__tests__/rc-installer.test.ts b/__tests__/rc-installer.test.ts index 2f72b96d..dcf3c851 100644 --- a/__tests__/rc-installer.test.ts +++ b/__tests__/rc-installer.test.ts @@ -560,7 +560,7 @@ describe('setup-node', () => { const infoSpy = jest.spyOn(core, 'info').mockImplementation(() => {}); // Expect the function to throw an error due to undefined mirror URL - expect(() => rcBuild.getDistributionMirrorUrl()).toThrowError( + expect(() => rcBuild.getDistributionMirrorUrl()).toThrow( 'Mirror URL is undefined. Please provide a valid mirror URL.' ); diff --git a/dist/setup/index.js b/dist/setup/index.js index 943b9007..2c51918a 100644 --- a/dist/setup/index.js +++ b/dist/setup/index.js @@ -100529,13 +100529,12 @@ class OfficialBuilds extends base_distribution_1.default { throw new Error('Mirror URL is empty. Please provide a valid mirror URL.'); } let downloadPath = ''; - let toolPath = ''; try { core.info(`Attempting to download using mirror URL...`); downloadPath = yield this.downloadFromMirrorURL(); // Attempt to download from the mirror core.info('downloadPath from downloadFromMirrorURL() ' + downloadPath); if (downloadPath) { - toolPath = downloadPath; + const toolPath = downloadPath; } } catch (err) { diff --git a/src/distributions/nightly/nightly_builds.ts b/src/distributions/nightly/nightly_builds.ts index 340d4579..3f7417cc 100644 --- a/src/distributions/nightly/nightly_builds.ts +++ b/src/distributions/nightly/nightly_builds.ts @@ -1,6 +1,5 @@ import BasePrereleaseNodejs from '../base-distribution-prerelease'; import {NodeInputs} from '../base-models'; -import * as core from '@actions/core'; export default class NightlyNodejs extends BasePrereleaseNodejs { protected distribution = 'nightly'; diff --git a/src/distributions/official_builds/official_builds.ts b/src/distributions/official_builds/official_builds.ts index d5cd1cb5..a6cce631 100644 --- a/src/distributions/official_builds/official_builds.ts +++ b/src/distributions/official_builds/official_builds.ts @@ -22,13 +22,13 @@ export default class OfficialBuilds extends BaseDistribution { ); } let downloadPath = ''; - let toolPath = ''; + try { core.info(`Attempting to download using mirror URL...`); downloadPath = await this.downloadFromMirrorURL(); // Attempt to download from the mirror core.info('downloadPath from downloadFromMirrorURL() ' + downloadPath); if (downloadPath) { - toolPath = downloadPath; + const toolPath = downloadPath; } } catch (err) { core.info((err as Error).message); diff --git a/src/distributions/rc/rc_builds.ts b/src/distributions/rc/rc_builds.ts index c194d4b1..2c2e25f4 100644 --- a/src/distributions/rc/rc_builds.ts +++ b/src/distributions/rc/rc_builds.ts @@ -1,6 +1,5 @@ import BaseDistribution from '../base-distribution'; import {NodeInputs} from '../base-models'; -import * as core from '@actions/core'; export default class RcBuild extends BaseDistribution { getDistributionMirrorUrl() {