@actions/tool-cache: convert to an ESM module

This commit is contained in:
Daniel Kennedy
2026-01-29 10:54:08 -05:00
parent 7a0147b5c6
commit 1f913ea3b2
10 changed files with 164 additions and 110 deletions
@@ -1,5 +1,5 @@
import * as tc from '../src/tool-cache'
import * as mm from '../src/manifest' // --> OFF
import * as tc from '../src/tool-cache.js'
import * as mm from '../src/manifest.js'
// needs to be require for core node modules to be mocked
// eslint-disable-next-line @typescript-eslint/no-require-imports
@@ -36,7 +36,7 @@ describe('@actions/tool-cache-manifest', () => {
archSpy.mockImplementation(() => os.arch)
execSpy = jest.spyOn(cp, 'execSync')
readLsbSpy = jest.spyOn(mm, '_readLinuxVersionFile')
readLsbSpy = jest.spyOn(mm._internal, 'readLinuxVersionFile')
getSpy = jest.spyOn(tc, 'getManifestFromRepo')
getSpy.mockImplementation(() => <mm.IToolRelease[]>manifestData)
@@ -1,5 +1,5 @@
import * as core from '@actions/core'
import {RetryHelper} from '../src/retry-helper'
import {RetryHelper} from '../src/retry-helper.js'
let info: string[]
let retryHelper: RetryHelper
@@ -12,7 +12,7 @@ process.env['RUNNER_TEMP'] = tempPath
process.env['RUNNER_TOOL_CACHE'] = cachePath
// eslint-disable-next-line import/first
import * as tc from '../src/tool-cache'
import * as tc from '../src/tool-cache.js'
const IS_WINDOWS = process.platform === 'win32'
const IS_MAC = process.platform === 'darwin'