Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix #1579: getCacheVersion mutates arguments #1587

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
6 changes: 6 additions & 0 deletions packages/cache/__tests__/cacheHttpClient.test.ts
Expand Up @@ -5,6 +5,12 @@ import {DownloadOptions, getDownloadOptions} from '../src/options'

jest.mock('../src/internal/downloadUtils')

test('getCacheVersion does not mutate arguments', async () => {
const paths = ['node_modules']
getCacheVersion(paths, undefined, true)
expect(paths).toEqual(['node_modules'])
})

test('getCacheVersion with one path returns version', async () => {
const paths = ['node_modules']
const result = getCacheVersion(paths, undefined, true)
Expand Down
2 changes: 1 addition & 1 deletion packages/cache/src/internal/cacheHttpClient.ts
Expand Up @@ -80,7 +80,7 @@ export function getCacheVersion(
compressionMethod?: CompressionMethod,
enableCrossOsArchive = false
): string {
const components = paths
const components = [...paths]

// Add compression method to cache version to restore
// compressed cache as per compression method
Expand Down