From cf0fe2d347f428fcb8ee1d3caef32c343a8a22e3 Mon Sep 17 00:00:00 2001 From: Dmitry Shibanov Date: Tue, 11 Jul 2023 12:19:16 +0200 Subject: [PATCH] resolve SymbolicLink --- __tests__/cache-utils.test.ts | 18 ++++++++++++++++++ __tests__/nightly-installer.test.ts | 2 ++ dist/cache-save/index.js | 1 + dist/setup/index.js | 1 + src/cache-utils.ts | 1 + 5 files changed, 23 insertions(+) diff --git a/__tests__/cache-utils.test.ts b/__tests__/cache-utils.test.ts index 39f376f21..a8c881e57 100644 --- a/__tests__/cache-utils.test.ts +++ b/__tests__/cache-utils.test.ts @@ -23,8 +23,10 @@ describe('cache-utils', () => { let isFeatureAvailable: jest.SpyInstance; let info: jest.SpyInstance; let warningSpy: jest.SpyInstance; + let fsRealPathSyncSpy: jest.SpyInstance; beforeEach(() => { + console.log('::stop-commands::stoptoken'); process.env['GITHUB_WORKSPACE'] = path.join(__dirname, 'data'); debugSpy = jest.spyOn(core, 'debug'); debugSpy.mockImplementation(msg => {}); @@ -35,8 +37,24 @@ describe('cache-utils', () => { isFeatureAvailable = jest.spyOn(cache, 'isFeatureAvailable'); getCommandOutputSpy = jest.spyOn(utils, 'getCommandOutput'); + + fsRealPathSyncSpy = jest.spyOn(fs, 'realpathSync'); + fsRealPathSyncSpy.mockImplementation(dirName => { + return dirName; + }); + }); + + afterEach(() => { + jest.resetAllMocks(); + jest.clearAllMocks(); + //jest.restoreAllMocks(); }); + afterAll(async () => { + console.log('::stoptoken::'); + jest.restoreAllMocks(); + }, 100000); + describe('getPackageManagerInfo', () => { it.each<[string, PackageManagerInfo | null]>([ ['npm', utils.supportedPackageManagers.npm], diff --git a/__tests__/nightly-installer.test.ts b/__tests__/nightly-installer.test.ts index 04a3253a9..87c437957 100644 --- a/__tests__/nightly-installer.test.ts +++ b/__tests__/nightly-installer.test.ts @@ -95,6 +95,8 @@ describe('setup-node', () => { res = nodeTestDistRc; } else if (url.includes('/nightly')) { res = nodeTestDistNightly; + } else if (url.includes('/v8-canary')) { + res = nodeV8CanaryTestDist; } else { res = nodeTestDist; } diff --git a/dist/cache-save/index.js b/dist/cache-save/index.js index a32351953..5721f61e5 100644 --- a/dist/cache-save/index.js +++ b/dist/cache-save/index.js @@ -60532,6 +60532,7 @@ const getProjectDirectoriesFromCacheDependencyPath = (cacheDependencyPath) => __ const existingDirectories = cacheDependenciesPaths .map(path_1.default.dirname) .filter(util_1.unique()) + .map(dirName => fs_1.default.realpathSync(dirName)) .filter(directory => fs_1.default.lstatSync(directory).isDirectory()); if (!existingDirectories.length) core.warning(`No existing directories found containing cache-dependency-path="${cacheDependencyPath}"`); diff --git a/dist/setup/index.js b/dist/setup/index.js index 5c500e239..b385398e9 100644 --- a/dist/setup/index.js +++ b/dist/setup/index.js @@ -71324,6 +71324,7 @@ const getProjectDirectoriesFromCacheDependencyPath = (cacheDependencyPath) => __ const existingDirectories = cacheDependenciesPaths .map(path_1.default.dirname) .filter(util_1.unique()) + .map(dirName => fs_1.default.realpathSync(dirName)) .filter(directory => fs_1.default.lstatSync(directory).isDirectory()); if (!existingDirectories.length) core.warning(`No existing directories found containing cache-dependency-path="${cacheDependencyPath}"`); diff --git a/src/cache-utils.ts b/src/cache-utils.ts index 8d25c36d5..7066d7333 100644 --- a/src/cache-utils.ts +++ b/src/cache-utils.ts @@ -144,6 +144,7 @@ const getProjectDirectoriesFromCacheDependencyPath = async ( const existingDirectories: string[] = cacheDependenciesPaths .map(path.dirname) .filter(unique()) + .map(dirName => fs.realpathSync(dirName)) .filter(directory => fs.lstatSync(directory).isDirectory()); if (!existingDirectories.length)