mirror of
https://git.mirrors.martin98.com/https://github.com/actions/toolkit
synced 2026-04-01 23:13:15 +08:00
updating deps
This commit is contained in:
@@ -68,7 +68,7 @@ describe('retry-helper tests', () => {
|
||||
|
||||
it('all attempts fail', async () => {
|
||||
let attempts = 0
|
||||
let error: Error = (null as unknown) as Error
|
||||
let error: Error = null as unknown as Error
|
||||
try {
|
||||
await retryHelper.execute(() => {
|
||||
throw new Error(`some error ${++attempts}`)
|
||||
@@ -87,7 +87,7 @@ describe('retry-helper tests', () => {
|
||||
|
||||
it('checks retryable after first attempt', async () => {
|
||||
let attempts = 0
|
||||
let error: Error = (null as unknown) as Error
|
||||
let error: Error = null as unknown as Error
|
||||
try {
|
||||
await retryHelper.execute(
|
||||
async () => {
|
||||
@@ -105,7 +105,7 @@ describe('retry-helper tests', () => {
|
||||
|
||||
it('checks retryable after second attempt', async () => {
|
||||
let attempts = 0
|
||||
let error: Error = (null as unknown) as Error
|
||||
let error: Error = null as unknown as Error
|
||||
try {
|
||||
await retryHelper.execute(
|
||||
async () => {
|
||||
|
||||
@@ -17,31 +17,28 @@ import * as tc from '../src/tool-cache'
|
||||
const IS_WINDOWS = process.platform === 'win32'
|
||||
const IS_MAC = process.platform === 'darwin'
|
||||
|
||||
describe('@actions/tool-cache', function() {
|
||||
beforeAll(function() {
|
||||
nock('http://example.com')
|
||||
.persist()
|
||||
.get('/bytes/35')
|
||||
.reply(200, {
|
||||
username: 'abc',
|
||||
password: 'def'
|
||||
})
|
||||
describe('@actions/tool-cache', function () {
|
||||
beforeAll(function () {
|
||||
nock('http://example.com').persist().get('/bytes/35').reply(200, {
|
||||
username: 'abc',
|
||||
password: 'def'
|
||||
})
|
||||
setGlobal('TEST_DOWNLOAD_TOOL_RETRY_MIN_SECONDS', 0)
|
||||
setGlobal('TEST_DOWNLOAD_TOOL_RETRY_MAX_SECONDS', 0)
|
||||
})
|
||||
|
||||
beforeEach(async function() {
|
||||
beforeEach(async function () {
|
||||
await io.rmRF(cachePath)
|
||||
await io.rmRF(tempPath)
|
||||
await io.mkdirP(cachePath)
|
||||
await io.mkdirP(tempPath)
|
||||
})
|
||||
|
||||
afterEach(function() {
|
||||
afterEach(function () {
|
||||
setResponseMessageFactory(undefined)
|
||||
})
|
||||
|
||||
afterAll(async function() {
|
||||
afterAll(async function () {
|
||||
await io.rmRF(tempPath)
|
||||
await io.rmRF(cachePath)
|
||||
setGlobal('TEST_DOWNLOAD_TOOL_RETRY_MIN_SECONDS', undefined)
|
||||
@@ -177,13 +174,10 @@ describe('@actions/tool-cache', function() {
|
||||
})
|
||||
|
||||
it('has status code in exception dictionary for HTTP error code responses', async () => {
|
||||
nock('http://example.com')
|
||||
.persist()
|
||||
.get('/bytes/bad')
|
||||
.reply(400, {
|
||||
username: 'bad',
|
||||
password: 'file'
|
||||
})
|
||||
nock('http://example.com').persist().get('/bytes/bad').reply(400, {
|
||||
username: 'bad',
|
||||
password: 'file'
|
||||
})
|
||||
|
||||
expect.assertions(2)
|
||||
|
||||
@@ -196,7 +190,7 @@ describe('@actions/tool-cache', function() {
|
||||
}
|
||||
})
|
||||
|
||||
it('works with redirect code 302', async function() {
|
||||
it('works with redirect code 302', async function () {
|
||||
nock('http://example.com')
|
||||
.persist()
|
||||
.get('/redirect-to')
|
||||
@@ -295,7 +289,7 @@ describe('@actions/tool-cache', function() {
|
||||
}
|
||||
})
|
||||
|
||||
it('extract 7z using custom 7z tool', async function() {
|
||||
it('extract 7z using custom 7z tool', async function () {
|
||||
const tempDir = path.join(
|
||||
__dirname,
|
||||
'test-extract-7z-using-custom-7z-tool'
|
||||
@@ -643,7 +637,7 @@ describe('@actions/tool-cache', function() {
|
||||
}
|
||||
)
|
||||
|
||||
it('installs a zip and extracts it to specified directory', async function() {
|
||||
it('installs a zip and extracts it to specified directory', async function () {
|
||||
const tempDir = path.join(__dirname, 'test-install-zip')
|
||||
try {
|
||||
await io.mkdirP(tempDir)
|
||||
@@ -706,7 +700,7 @@ describe('@actions/tool-cache', function() {
|
||||
}
|
||||
})
|
||||
|
||||
it('extract zip to a directory that does not exist', async function() {
|
||||
it('extract zip to a directory that does not exist', async function () {
|
||||
const tempDir = path.join(__dirname, 'test-install-zip')
|
||||
try {
|
||||
await io.mkdirP(tempDir)
|
||||
@@ -762,24 +756,16 @@ describe('@actions/tool-cache', function() {
|
||||
}
|
||||
})
|
||||
|
||||
it('works with a 502 temporary failure', async function() {
|
||||
nock('http://example.com')
|
||||
.get('/temp502')
|
||||
.twice()
|
||||
.reply(502, undefined)
|
||||
nock('http://example.com')
|
||||
.get('/temp502')
|
||||
.reply(200, undefined)
|
||||
it('works with a 502 temporary failure', async function () {
|
||||
nock('http://example.com').get('/temp502').twice().reply(502, undefined)
|
||||
nock('http://example.com').get('/temp502').reply(200, undefined)
|
||||
|
||||
const statusCodeUrl = 'http://example.com/temp502'
|
||||
await tc.downloadTool(statusCodeUrl)
|
||||
})
|
||||
|
||||
it("doesn't retry 502s more than 3 times", async function() {
|
||||
nock('http://example.com')
|
||||
.get('/perm502')
|
||||
.times(3)
|
||||
.reply(502, undefined)
|
||||
it("doesn't retry 502s more than 3 times", async function () {
|
||||
nock('http://example.com').get('/perm502').times(3).reply(502, undefined)
|
||||
|
||||
expect.assertions(1)
|
||||
|
||||
@@ -791,7 +777,7 @@ describe('@actions/tool-cache', function() {
|
||||
}
|
||||
})
|
||||
|
||||
it('retries 429s', async function() {
|
||||
it('retries 429s', async function () {
|
||||
nock('http://example.com')
|
||||
.get('/too-many-requests-429')
|
||||
.times(2)
|
||||
@@ -808,13 +794,9 @@ describe('@actions/tool-cache', function() {
|
||||
}
|
||||
})
|
||||
|
||||
it("doesn't retry 404", async function() {
|
||||
nock('http://example.com')
|
||||
.get('/not-found-404')
|
||||
.reply(404, undefined)
|
||||
nock('http://example.com')
|
||||
.get('/not-found-404')
|
||||
.reply(500, undefined)
|
||||
it("doesn't retry 404", async function () {
|
||||
nock('http://example.com').get('/not-found-404').reply(404, undefined)
|
||||
nock('http://example.com').get('/not-found-404').reply(500, undefined)
|
||||
|
||||
try {
|
||||
const statusCodeUrl = 'http://example.com/not-found-404'
|
||||
@@ -824,7 +806,7 @@ describe('@actions/tool-cache', function() {
|
||||
}
|
||||
})
|
||||
|
||||
it('supports authorization headers', async function() {
|
||||
it('supports authorization headers', async function () {
|
||||
nock('http://example.com', {
|
||||
reqheaders: {
|
||||
authorization: 'token abc123'
|
||||
@@ -840,7 +822,7 @@ describe('@actions/tool-cache', function() {
|
||||
)
|
||||
})
|
||||
|
||||
it('supports custom headers', async function() {
|
||||
it('supports custom headers', async function () {
|
||||
nock('http://example.com', {
|
||||
reqheaders: {
|
||||
accept: 'application/octet-stream'
|
||||
@@ -859,7 +841,7 @@ describe('@actions/tool-cache', function() {
|
||||
)
|
||||
})
|
||||
|
||||
it('supports authorization and custom headers', async function() {
|
||||
it('supports authorization and custom headers', async function () {
|
||||
nock('http://example.com', {
|
||||
reqheaders: {
|
||||
accept: 'application/octet-stream',
|
||||
|
||||
12
packages/tool-cache/package-lock.json
generated
12
packages/tool-cache/package-lock.json
generated
@@ -145,9 +145,9 @@
|
||||
}
|
||||
},
|
||||
"node_modules/semver": {
|
||||
"version": "6.3.0",
|
||||
"resolved": "https://registry.npmjs.org/semver/-/semver-6.3.0.tgz",
|
||||
"integrity": "sha512-b39TBaTSfV6yBrapU89p5fKekE2m/NwnDocOVruQFS1/veMgdzuPcnOM34M6CwxW8jH/lxEa5rBoDeUwu5HHTw==",
|
||||
"version": "6.3.1",
|
||||
"resolved": "https://registry.npmjs.org/semver/-/semver-6.3.1.tgz",
|
||||
"integrity": "sha512-BR7VvDCVHO+q2xBEWskxS6DJE1qRnb7DxzUrogb71CWoSficBxYsiAGd+Kl0mmq/MprG9yArRkyrQxTO6XjMzA==",
|
||||
"bin": {
|
||||
"semver": "bin/semver.js"
|
||||
}
|
||||
@@ -284,9 +284,9 @@
|
||||
"dev": true
|
||||
},
|
||||
"semver": {
|
||||
"version": "6.3.0",
|
||||
"resolved": "https://registry.npmjs.org/semver/-/semver-6.3.0.tgz",
|
||||
"integrity": "sha512-b39TBaTSfV6yBrapU89p5fKekE2m/NwnDocOVruQFS1/veMgdzuPcnOM34M6CwxW8jH/lxEa5rBoDeUwu5HHTw=="
|
||||
"version": "6.3.1",
|
||||
"resolved": "https://registry.npmjs.org/semver/-/semver-6.3.1.tgz",
|
||||
"integrity": "sha512-BR7VvDCVHO+q2xBEWskxS6DJE1qRnb7DxzUrogb71CWoSficBxYsiAGd+Kl0mmq/MprG9yArRkyrQxTO6XjMzA=="
|
||||
},
|
||||
"tunnel": {
|
||||
"version": "0.0.6",
|
||||
|
||||
@@ -140,10 +140,7 @@ export function _getOsVersion(): string {
|
||||
(parts[0].trim() === 'VERSION_ID' ||
|
||||
parts[0].trim() === 'DISTRIB_RELEASE')
|
||||
) {
|
||||
version = parts[1]
|
||||
.trim()
|
||||
.replace(/^"/, '')
|
||||
.replace(/"$/, '')
|
||||
version = parts[1].trim().replace(/^"/, '').replace(/"$/, '')
|
||||
break
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user