Skip to content

Commit

Permalink
resolve SymbolicLink (#809)
Browse files Browse the repository at this point in the history
  • Loading branch information
dmitry-shibanov authored Jul 13, 2023
1 parent 3405007 commit c7a93de
Show file tree
Hide file tree
Showing 5 changed files with 23 additions and 0 deletions.
18 changes: 18 additions & 0 deletions __tests__/cache-utils.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 => {});
Expand All @@ -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],
Expand Down
2 changes: 2 additions & 0 deletions __tests__/nightly-installer.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,8 @@ describe('setup-node', () => {
res = <INodeVersion[]>nodeTestDistRc;
} else if (url.includes('/nightly')) {
res = <INodeVersion[]>nodeTestDistNightly;
} else if (url.includes('/v8-canary')) {
res = <INodeVersion[]>nodeV8CanaryTestDist;
} else {
res = <INodeVersion[]>nodeTestDist;
}
Expand Down
1 change: 1 addition & 0 deletions dist/cache-save/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -60556,6 +60556,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}"`);
Expand Down
1 change: 1 addition & 0 deletions dist/setup/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -71343,6 +71343,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}"`);
Expand Down
1 change: 1 addition & 0 deletions src/cache-utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

8 comments on commit c7a93de

@miladdastyar77
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[c7a93de](1m)

@miladdastyar77
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@miladdastyar77
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@miladdastyar77
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@miladdastyar77
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@miladdastyar77
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@miladdastyar77
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@miladdastyar77
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.