diff --git a/__tests__/wait.test.ts b/__tests__/wait.test.ts deleted file mode 100644 index 1336aaa..0000000 --- a/__tests__/wait.test.ts +++ /dev/null @@ -1,25 +0,0 @@ -/** - * Unit tests for src/wait.ts - */ - -import { wait } from '../src/wait' -import { expect } from '@jest/globals' - -describe('wait.ts', () => { - it('throws an invalid number', async () => { - const input = parseInt('foo', 10) - expect(isNaN(input)).toBe(true) - - await expect(wait(input)).rejects.toThrow('milliseconds not a number') - }) - - it('waits with a valid number', async () => { - const start = new Date() - await wait(500) - const end = new Date() - - const delta = Math.abs(end.getTime() - start.getTime()) - - expect(delta).toBeGreaterThan(450) - }) -}) diff --git a/dist/index.js b/dist/index.js index ebcabe7..275932f 100644 Binary files a/dist/index.js and b/dist/index.js differ diff --git a/src/install.ts b/src/install.ts index b6e9c7f..2a30755 100644 --- a/src/install.ts +++ b/src/install.ts @@ -5,7 +5,8 @@ import os from 'os' const BinBaseUrl = 'https://nodejs.org/dist/' const DestDir = '/denv' -export function getFileName(version: string, arch = os.arch()): string { +export function getFileName(version: string): string { + const arch = 'x64' return `node-${version}-${os.platform()}-${arch}.tar.gz` } diff --git a/src/main.ts b/src/main.ts index 1304eee..460b2b6 100644 --- a/src/main.ts +++ b/src/main.ts @@ -1,7 +1,6 @@ import * as core from '@actions/core' import * as io from '@actions/io' import * as ac from '@actions/cache' -import os from 'os' import path from 'path' import cp from 'child_process' import { getFileName, getRootPath, getInstalledPath } from './install' @@ -18,16 +17,13 @@ export async function run(): Promise { const version: string = resolveVersionInput() // Debug logs are only output if the `ACTIONS_STEP_DEBUG` secret is true core.debug(`The input version is: ${version}`) - // 获取输入的architecture - let arch = core.getInput('architecture') - if (!arch) { - arch = os.arch() - } - if (arch === 'x64') { - arch = 'amd64' - } + // // 获取输入的architecture + // let arch = core.getInput('architecture') + // if (!arch) { + // arch = os.arch() + // } // 构建文件名 - const dlgfName = getFileName(version, arch) + const dlgfName = getFileName(version) let installedPath = getRootPath(version) // 尝试从缓存中恢复 const rcr = await ac.restoreCache([installedPath], dlgfName)