From 7533af2e971e7bd12fec0f29587d316feb7a527f Mon Sep 17 00:00:00 2001 From: Salman Muin Kayser Chishti Date: Thu, 31 Jul 2025 23:48:44 +0100 Subject: [PATCH] updates --- __tests__/saveCache.test.ts | 20 ++++++++++++-------- package-lock.json | 33 ++++++++++++++++++--------------- 2 files changed, 30 insertions(+), 23 deletions(-) diff --git a/__tests__/saveCache.test.ts b/__tests__/saveCache.test.ts index ab5d380..2c1250f 100644 --- a/__tests__/saveCache.test.ts +++ b/__tests__/saveCache.test.ts @@ -225,20 +225,25 @@ test('save with server error should fail', async () => { const filePath = 'node_modules' const primaryKey = 'Linux-node-bb828da54c148048dd17899ba9fda624811cfb43' const logErrorMock = jest.spyOn(core, 'error') - const logWarningMock = jest.spyOn(core, 'warning') + // Removing the unused variable logWarningMock // Mock cache service version to V2 - const getCacheServiceVersionMock = jest.spyOn(config, 'getCacheServiceVersion').mockReturnValue('v2') + const getCacheServiceVersionMock = jest + .spyOn(config, 'getCacheServiceVersion') + .mockReturnValue('v2') // Mock V2 CreateCacheEntry to succeed const createCacheEntryMock = jest .spyOn(CacheServiceClientJSON.prototype, 'CreateCacheEntry') .mockReturnValue( - Promise.resolve({ok: true, signedUploadUrl: 'https://blob-storage.local?signed=true'}) + Promise.resolve({ + ok: true, + signedUploadUrl: 'https://blob-storage.local?signed=true' + }) ) // Mock the FinalizeCacheEntryUpload to succeed (since the error should happen in saveCache) - const finalizeCacheEntryMock = jest + jest .spyOn(CacheServiceClientJSON.prototype, 'FinalizeCacheEntryUpload') .mockReturnValue(Promise.resolve({ok: true, entryId: '4'})) @@ -257,7 +262,7 @@ test('save with server error should fail', async () => { .mockReturnValueOnce(Promise.resolve(compression)) await saveCache([filePath], primaryKey) - + expect(logErrorMock).toHaveBeenCalledTimes(1) expect(logErrorMock).toHaveBeenCalledWith( 'Failed to save: HTTP Error Occurred' @@ -266,7 +271,7 @@ test('save with server error should fail', async () => { expect(createCacheEntryMock).toHaveBeenCalledTimes(1) const archiveFolder = '/foo/bar' const cachePaths = [path.resolve(filePath)] - const archiveFile = path.join(archiveFolder, CacheFilename.Zstd) + // Removing the unused variable archiveFile expect(createTarMock).toHaveBeenCalledTimes(1) expect(createTarMock).toHaveBeenCalledWith( archiveFolder, @@ -275,8 +280,7 @@ test('save with server error should fail', async () => { ) expect(saveCacheMock).toHaveBeenCalledTimes(1) expect(getCompressionMock).toHaveBeenCalledTimes(1) - expect(getCompressionMock).toHaveBeenCalledTimes(1) - + // Restore the getCacheServiceVersion mock to its original state getCacheServiceVersionMock.mockRestore() }) diff --git a/package-lock.json b/package-lock.json index 0f73cb7..7a2a95f 100644 --- a/package-lock.json +++ b/package-lock.json @@ -21,9 +21,12 @@ }, "devDependencies": { "@protobuf-ts/plugin": "^2.9.4", - "@types/node": "^22.13.9", + "@types/node": "^24.1.0", "@types/semver": "^6.0.0", "typescript": "^5.2.2" + }, + "engines": { + "node": ">=24.0.0" } }, "node_modules/@actions/core": { @@ -335,12 +338,12 @@ } }, "node_modules/@types/node": { - "version": "22.13.9", - "resolved": "https://registry.npmjs.org/@types/node/-/node-22.13.9.tgz", - "integrity": "sha512-acBjXdRJ3A6Pb3tqnw9HZmyR3Fiol3aGxRCK1x3d+6CDAMjl7I649wpSd+yNURCjbOUGu9tqtLKnTGxmK6CyGw==", + "version": "24.1.0", + "resolved": "https://registry.npmjs.org/@types/node/-/node-24.1.0.tgz", + "integrity": "sha512-ut5FthK5moxFKH2T1CUOC6ctR67rQRvvHdFLCD2Ql6KXmMuCrjsSsRI9UsLCm9M18BMwClv4pn327UvB7eeO1w==", "license": "MIT", "dependencies": { - "undici-types": "~6.20.0" + "undici-types": "~7.8.0" } }, "node_modules/@types/node-fetch": { @@ -770,9 +773,9 @@ } }, "node_modules/undici-types": { - "version": "6.20.0", - "resolved": "https://registry.npmjs.org/undici-types/-/undici-types-6.20.0.tgz", - "integrity": "sha512-Ny6QZ2Nju20vw1SRHe3d9jVu6gJ+4e3+MMpqu7pqE5HT6WsTSlce++GQmK5UXS8mzV8DSYHrQH+Xrf2jVcuKNg==", + "version": "7.8.0", + "resolved": "https://registry.npmjs.org/undici-types/-/undici-types-7.8.0.tgz", + "integrity": "sha512-9UJ2xGDvQ43tYyVMpuHlsgApydB8ZKfVYTsLDhXkFL/6gfkp+U8xTGdh8pMJv1SpZna0zxG1DwsKZsreLbXBxw==", "license": "MIT" }, "node_modules/webidl-conversions": { @@ -1060,11 +1063,11 @@ } }, "@types/node": { - "version": "22.13.9", - "resolved": "https://registry.npmjs.org/@types/node/-/node-22.13.9.tgz", - "integrity": "sha512-acBjXdRJ3A6Pb3tqnw9HZmyR3Fiol3aGxRCK1x3d+6CDAMjl7I649wpSd+yNURCjbOUGu9tqtLKnTGxmK6CyGw==", + "version": "24.1.0", + "resolved": "https://registry.npmjs.org/@types/node/-/node-24.1.0.tgz", + "integrity": "sha512-ut5FthK5moxFKH2T1CUOC6ctR67rQRvvHdFLCD2Ql6KXmMuCrjsSsRI9UsLCm9M18BMwClv4pn327UvB7eeO1w==", "requires": { - "undici-types": "~6.20.0" + "undici-types": "~7.8.0" } }, "@types/node-fetch": { @@ -1353,9 +1356,9 @@ "dev": true }, "undici-types": { - "version": "6.20.0", - "resolved": "https://registry.npmjs.org/undici-types/-/undici-types-6.20.0.tgz", - "integrity": "sha512-Ny6QZ2Nju20vw1SRHe3d9jVu6gJ+4e3+MMpqu7pqE5HT6WsTSlce++GQmK5UXS8mzV8DSYHrQH+Xrf2jVcuKNg==" + "version": "7.8.0", + "resolved": "https://registry.npmjs.org/undici-types/-/undici-types-7.8.0.tgz", + "integrity": "sha512-9UJ2xGDvQ43tYyVMpuHlsgApydB8ZKfVYTsLDhXkFL/6gfkp+U8xTGdh8pMJv1SpZna0zxG1DwsKZsreLbXBxw==" }, "webidl-conversions": { "version": "3.0.1",