mirror of https://github.com/actions/toolkit
prettier
parent
400d7a5357
commit
e8f2199348
|
@ -1,8 +1,7 @@
|
||||||
import CRC64, {CRC64DigestEncoding} from '../src/internal/crc64'
|
import CRC64, {CRC64DigestEncoding} from '../src/internal/crc64'
|
||||||
|
|
||||||
const fixtures = {
|
const fixtures = {
|
||||||
data:
|
data: '🚀 👉😎👉 Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.\nUt enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.\nDuis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur.\nExcepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.\n',
|
||||||
'🚀 👉😎👉 Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.\nUt enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.\nDuis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur.\nExcepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.\n',
|
|
||||||
expected: {
|
expected: {
|
||||||
hex: '846CE4ADAD6223ED',
|
hex: '846CE4ADAD6223ED',
|
||||||
base64: '7SNira3kbIQ=',
|
base64: '7SNira3kbIQ=',
|
||||||
|
|
|
@ -276,7 +276,7 @@ describe('Download Tests', () => {
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
const returnData: string = JSON.stringify(response, null, 2)
|
const returnData: string = JSON.stringify(response, null, 2)
|
||||||
mockReadBody = async function(): Promise<string> {
|
mockReadBody = async function (): Promise<string> {
|
||||||
return new Promise(resolve => {
|
return new Promise(resolve => {
|
||||||
resolve(returnData)
|
resolve(returnData)
|
||||||
})
|
})
|
||||||
|
@ -447,7 +447,7 @@ describe('Download Tests', () => {
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
const returnData: string = JSON.stringify(response, null, 2)
|
const returnData: string = JSON.stringify(response, null, 2)
|
||||||
mockReadBody = async function(): Promise<string> {
|
mockReadBody = async function (): Promise<string> {
|
||||||
return new Promise(resolve => {
|
return new Promise(resolve => {
|
||||||
resolve(returnData)
|
resolve(returnData)
|
||||||
})
|
})
|
||||||
|
|
|
@ -480,7 +480,7 @@ describe('Upload Tests', () => {
|
||||||
}`
|
}`
|
||||||
}
|
}
|
||||||
const returnData: string = JSON.stringify(response, null, 2)
|
const returnData: string = JSON.stringify(response, null, 2)
|
||||||
mockReadBody = async function(): Promise<string> {
|
mockReadBody = async function (): Promise<string> {
|
||||||
return new Promise(resolve => {
|
return new Promise(resolve => {
|
||||||
resolve(returnData)
|
resolve(returnData)
|
||||||
})
|
})
|
||||||
|
@ -548,7 +548,7 @@ describe('Upload Tests', () => {
|
||||||
uploadUrl: `${getRuntimeUrl()}_apis/resources/Containers/13`
|
uploadUrl: `${getRuntimeUrl()}_apis/resources/Containers/13`
|
||||||
}
|
}
|
||||||
const returnData: string = JSON.stringify(response, null, 2)
|
const returnData: string = JSON.stringify(response, null, 2)
|
||||||
mockReadBody = async function(): Promise<string> {
|
mockReadBody = async function (): Promise<string> {
|
||||||
return new Promise(resolve => {
|
return new Promise(resolve => {
|
||||||
resolve(returnData)
|
resolve(returnData)
|
||||||
})
|
})
|
||||||
|
|
|
@ -29,9 +29,8 @@ describe('Utils', () => {
|
||||||
expect(retryWaitTime0).toEqual(getInitialRetryIntervalInMilliseconds())
|
expect(retryWaitTime0).toEqual(getInitialRetryIntervalInMilliseconds())
|
||||||
|
|
||||||
const testMinMaxRange = (retryCount: number): void => {
|
const testMinMaxRange = (retryCount: number): void => {
|
||||||
const retryWaitTime = utils.getExponentialRetryTimeInMilliseconds(
|
const retryWaitTime =
|
||||||
retryCount
|
utils.getExponentialRetryTimeInMilliseconds(retryCount)
|
||||||
)
|
|
||||||
const minRange =
|
const minRange =
|
||||||
getInitialRetryIntervalInMilliseconds() *
|
getInitialRetryIntervalInMilliseconds() *
|
||||||
getRetryMultiplier() *
|
getRetryMultiplier() *
|
||||||
|
|
|
@ -92,10 +92,7 @@ export function getCacheVersion(
|
||||||
// Add salt to cache version to support breaking changes in cache entry
|
// Add salt to cache version to support breaking changes in cache entry
|
||||||
components.push(versionSalt)
|
components.push(versionSalt)
|
||||||
|
|
||||||
return crypto
|
return crypto.createHash('sha256').update(components.join('|')).digest('hex')
|
||||||
.createHash('sha256')
|
|
||||||
.update(components.join('|'))
|
|
||||||
.digest('hex')
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export async function getCacheEntry(
|
export async function getCacheEntry(
|
||||||
|
@ -230,9 +227,9 @@ async function uploadChunk(
|
||||||
end: number
|
end: number
|
||||||
): Promise<void> {
|
): Promise<void> {
|
||||||
core.debug(
|
core.debug(
|
||||||
`Uploading chunk of size ${end -
|
`Uploading chunk of size ${
|
||||||
start +
|
end - start + 1
|
||||||
1} bytes at offset ${start} with content range: ${getContentRange(
|
} bytes at offset ${start} with content range: ${getContentRange(
|
||||||
start,
|
start,
|
||||||
end
|
end
|
||||||
)}`
|
)}`
|
||||||
|
|
|
@ -17,7 +17,7 @@ describe('@actions/core/src/command', () => {
|
||||||
afterEach(() => {})
|
afterEach(() => {})
|
||||||
|
|
||||||
afterAll(() => {
|
afterAll(() => {
|
||||||
process.stdout.write = (originalWriteFunction as unknown) as (
|
process.stdout.write = originalWriteFunction as unknown as (
|
||||||
str: string
|
str: string
|
||||||
) => boolean
|
) => boolean
|
||||||
})
|
})
|
||||||
|
@ -51,8 +51,7 @@ describe('@actions/core/src/command', () => {
|
||||||
command.issueCommand(
|
command.issueCommand(
|
||||||
'some-command',
|
'some-command',
|
||||||
{
|
{
|
||||||
name:
|
name: 'percent % percent % cr \r cr \r lf \n lf \n colon : colon : comma , comma ,'
|
||||||
'percent % percent % cr \r cr \r lf \n lf \n colon : colon : comma , comma ,'
|
|
||||||
},
|
},
|
||||||
''
|
''
|
||||||
)
|
)
|
||||||
|
@ -117,11 +116,11 @@ describe('@actions/core/src/command', () => {
|
||||||
command.issueCommand(
|
command.issueCommand(
|
||||||
'some-command',
|
'some-command',
|
||||||
{
|
{
|
||||||
prop1: ({test: 'object'} as unknown) as string,
|
prop1: {test: 'object'} as unknown as string,
|
||||||
prop2: (123 as unknown) as string,
|
prop2: 123 as unknown as string,
|
||||||
prop3: (true as unknown) as string
|
prop3: true as unknown as string
|
||||||
},
|
},
|
||||||
({test: 'object'} as unknown) as string
|
{test: 'object'} as unknown as string
|
||||||
)
|
)
|
||||||
assertWriteCalls([
|
assertWriteCalls([
|
||||||
`::some-command prop1={"test"%3A"object"},prop2=123,prop3=true::{"test":"object"}${os.EOL}`
|
`::some-command prop1={"test"%3A"object"},prop2=123,prop3=true::{"test":"object"}${os.EOL}`
|
||||||
|
|
|
@ -150,10 +150,7 @@ describe('@actions/core/src/summary', () => {
|
||||||
})
|
})
|
||||||
|
|
||||||
it('adds EOL', async () => {
|
it('adds EOL', async () => {
|
||||||
await summary
|
await summary.addRaw(fixtures.text).addEOL().write()
|
||||||
.addRaw(fixtures.text)
|
|
||||||
.addEOL()
|
|
||||||
.write()
|
|
||||||
await assertSummary(fixtures.text + os.EOL)
|
await assertSummary(fixtures.text + os.EOL)
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
|
@ -357,7 +357,7 @@ describe('@actions/exec', () => {
|
||||||
expect(exitCode).toBe(0)
|
expect(exitCode).toBe(0)
|
||||||
})
|
})
|
||||||
|
|
||||||
it('Handles child process holding streams open', async function() {
|
it('Handles child process holding streams open', async function () {
|
||||||
const semaphorePath = path.join(
|
const semaphorePath = path.join(
|
||||||
getTestTemp(),
|
getTestTemp(),
|
||||||
'child-process-semaphore.txt'
|
'child-process-semaphore.txt'
|
||||||
|
@ -403,7 +403,7 @@ describe('@actions/exec', () => {
|
||||||
fs.unlinkSync(semaphorePath)
|
fs.unlinkSync(semaphorePath)
|
||||||
}, 10000) // this was timing out on some slower hosted macOS runs at default 5s
|
}, 10000) // this was timing out on some slower hosted macOS runs at default 5s
|
||||||
|
|
||||||
it('Handles child process holding streams open and non-zero exit code', async function() {
|
it('Handles child process holding streams open and non-zero exit code', async function () {
|
||||||
const semaphorePath = path.join(
|
const semaphorePath = path.join(
|
||||||
getTestTemp(),
|
getTestTemp(),
|
||||||
'child-process-semaphore.txt'
|
'child-process-semaphore.txt'
|
||||||
|
@ -457,7 +457,7 @@ describe('@actions/exec', () => {
|
||||||
fs.unlinkSync(semaphorePath)
|
fs.unlinkSync(semaphorePath)
|
||||||
}, 10000) // this was timing out on some slower hosted macOS runs at default 5s
|
}, 10000) // this was timing out on some slower hosted macOS runs at default 5s
|
||||||
|
|
||||||
it('Handles child process holding streams open and stderr', async function() {
|
it('Handles child process holding streams open and stderr', async function () {
|
||||||
const semaphorePath = path.join(
|
const semaphorePath = path.join(
|
||||||
getTestTemp(),
|
getTestTemp(),
|
||||||
'child-process-semaphore.txt'
|
'child-process-semaphore.txt'
|
||||||
|
|
|
@ -267,10 +267,7 @@ export class ToolRunner extends events.EventEmitter {
|
||||||
}
|
}
|
||||||
|
|
||||||
reverse += '"'
|
reverse += '"'
|
||||||
return reverse
|
return reverse.split('').reverse().join('')
|
||||||
.split('')
|
|
||||||
.reverse()
|
|
||||||
.join('')
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private _uvQuoteCmdArg(arg: string): string {
|
private _uvQuoteCmdArg(arg: string): string {
|
||||||
|
@ -350,10 +347,7 @@ export class ToolRunner extends events.EventEmitter {
|
||||||
}
|
}
|
||||||
|
|
||||||
reverse += '"'
|
reverse += '"'
|
||||||
return reverse
|
return reverse.split('').reverse().join('')
|
||||||
.split('')
|
|
||||||
.reverse()
|
|
||||||
.join('')
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private _cloneExecOptions(options?: im.ExecOptions): im.ExecOptions {
|
private _cloneExecOptions(options?: im.ExecOptions): im.ExecOptions {
|
||||||
|
@ -691,8 +685,9 @@ class ExecState extends events.EventEmitter {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!state.processClosed && state.processExited) {
|
if (!state.processClosed && state.processExited) {
|
||||||
const message = `The STDIO streams did not close within ${state.delay /
|
const message = `The STDIO streams did not close within ${
|
||||||
1000} seconds of the exit event from process '${
|
state.delay / 1000
|
||||||
|
} seconds of the exit event from process '${
|
||||||
state.toolPath
|
state.toolPath
|
||||||
}'. This may indicate a child process inherited the STDIO streams and has not yet exited.`
|
}'. This may indicate a child process inherited the STDIO streams and has not yet exited.`
|
||||||
state._debug(message)
|
state._debug(message)
|
||||||
|
|
|
@ -31,9 +31,8 @@ describe('auth', () => {
|
||||||
|
|
||||||
it('does basic http get request with pat token auth', async () => {
|
it('does basic http get request with pat token auth', async () => {
|
||||||
const token = 'scbfb44vxzku5l4xgc3qfazn3lpk4awflfryc76esaiq7aypcbhs'
|
const token = 'scbfb44vxzku5l4xgc3qfazn3lpk4awflfryc76esaiq7aypcbhs'
|
||||||
const ph: am.PersonalAccessTokenCredentialHandler = new am.PersonalAccessTokenCredentialHandler(
|
const ph: am.PersonalAccessTokenCredentialHandler =
|
||||||
token
|
new am.PersonalAccessTokenCredentialHandler(token)
|
||||||
)
|
|
||||||
|
|
||||||
const http: httpm.HttpClient = new httpm.HttpClient('http-client-tests', [
|
const http: httpm.HttpClient = new httpm.HttpClient('http-client-tests', [
|
||||||
ph
|
ph
|
||||||
|
|
|
@ -57,7 +57,8 @@ export class BearerCredentialHandler implements ifm.RequestHandler {
|
||||||
}
|
}
|
||||||
|
|
||||||
export class PersonalAccessTokenCredentialHandler
|
export class PersonalAccessTokenCredentialHandler
|
||||||
implements ifm.RequestHandler {
|
implements ifm.RequestHandler
|
||||||
|
{
|
||||||
token: string
|
token: string
|
||||||
|
|
||||||
constructor(token: string) {
|
constructor(token: string) {
|
||||||
|
|
|
@ -519,7 +519,7 @@ export class HttpClient {
|
||||||
handleResult(new Error(`Request timeout: ${info.options.path}`))
|
handleResult(new Error(`Request timeout: ${info.options.path}`))
|
||||||
})
|
})
|
||||||
|
|
||||||
req.on('error', function(err) {
|
req.on('error', function (err) {
|
||||||
// err has statusCode property
|
// err has statusCode property
|
||||||
// res should have headers
|
// res should have headers
|
||||||
handleResult(err)
|
handleResult(err)
|
||||||
|
@ -530,7 +530,7 @@ export class HttpClient {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (data && typeof data !== 'string') {
|
if (data && typeof data !== 'string') {
|
||||||
data.on('close', function() {
|
data.on('close', function () {
|
||||||
req.end()
|
req.end()
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
|
@ -68,7 +68,7 @@ describe('retry-helper tests', () => {
|
||||||
|
|
||||||
it('all attempts fail', async () => {
|
it('all attempts fail', async () => {
|
||||||
let attempts = 0
|
let attempts = 0
|
||||||
let error: Error = (null as unknown) as Error
|
let error: Error = null as unknown as Error
|
||||||
try {
|
try {
|
||||||
await retryHelper.execute(() => {
|
await retryHelper.execute(() => {
|
||||||
throw new Error(`some error ${++attempts}`)
|
throw new Error(`some error ${++attempts}`)
|
||||||
|
@ -87,7 +87,7 @@ describe('retry-helper tests', () => {
|
||||||
|
|
||||||
it('checks retryable after first attempt', async () => {
|
it('checks retryable after first attempt', async () => {
|
||||||
let attempts = 0
|
let attempts = 0
|
||||||
let error: Error = (null as unknown) as Error
|
let error: Error = null as unknown as Error
|
||||||
try {
|
try {
|
||||||
await retryHelper.execute(
|
await retryHelper.execute(
|
||||||
async () => {
|
async () => {
|
||||||
|
@ -105,7 +105,7 @@ describe('retry-helper tests', () => {
|
||||||
|
|
||||||
it('checks retryable after second attempt', async () => {
|
it('checks retryable after second attempt', async () => {
|
||||||
let attempts = 0
|
let attempts = 0
|
||||||
let error: Error = (null as unknown) as Error
|
let error: Error = null as unknown as Error
|
||||||
try {
|
try {
|
||||||
await retryHelper.execute(
|
await retryHelper.execute(
|
||||||
async () => {
|
async () => {
|
||||||
|
|
|
@ -17,12 +17,9 @@ import * as tc from '../src/tool-cache'
|
||||||
const IS_WINDOWS = process.platform === 'win32'
|
const IS_WINDOWS = process.platform === 'win32'
|
||||||
const IS_MAC = process.platform === 'darwin'
|
const IS_MAC = process.platform === 'darwin'
|
||||||
|
|
||||||
describe('@actions/tool-cache', function() {
|
describe('@actions/tool-cache', function () {
|
||||||
beforeAll(function() {
|
beforeAll(function () {
|
||||||
nock('http://example.com')
|
nock('http://example.com').persist().get('/bytes/35').reply(200, {
|
||||||
.persist()
|
|
||||||
.get('/bytes/35')
|
|
||||||
.reply(200, {
|
|
||||||
username: 'abc',
|
username: 'abc',
|
||||||
password: 'def'
|
password: 'def'
|
||||||
})
|
})
|
||||||
|
@ -30,18 +27,18 @@ describe('@actions/tool-cache', function() {
|
||||||
setGlobal('TEST_DOWNLOAD_TOOL_RETRY_MAX_SECONDS', 0)
|
setGlobal('TEST_DOWNLOAD_TOOL_RETRY_MAX_SECONDS', 0)
|
||||||
})
|
})
|
||||||
|
|
||||||
beforeEach(async function() {
|
beforeEach(async function () {
|
||||||
await io.rmRF(cachePath)
|
await io.rmRF(cachePath)
|
||||||
await io.rmRF(tempPath)
|
await io.rmRF(tempPath)
|
||||||
await io.mkdirP(cachePath)
|
await io.mkdirP(cachePath)
|
||||||
await io.mkdirP(tempPath)
|
await io.mkdirP(tempPath)
|
||||||
})
|
})
|
||||||
|
|
||||||
afterEach(function() {
|
afterEach(function () {
|
||||||
setResponseMessageFactory(undefined)
|
setResponseMessageFactory(undefined)
|
||||||
})
|
})
|
||||||
|
|
||||||
afterAll(async function() {
|
afterAll(async function () {
|
||||||
await io.rmRF(tempPath)
|
await io.rmRF(tempPath)
|
||||||
await io.rmRF(cachePath)
|
await io.rmRF(cachePath)
|
||||||
setGlobal('TEST_DOWNLOAD_TOOL_RETRY_MIN_SECONDS', undefined)
|
setGlobal('TEST_DOWNLOAD_TOOL_RETRY_MIN_SECONDS', undefined)
|
||||||
|
@ -177,10 +174,7 @@ describe('@actions/tool-cache', function() {
|
||||||
})
|
})
|
||||||
|
|
||||||
it('has status code in exception dictionary for HTTP error code responses', async () => {
|
it('has status code in exception dictionary for HTTP error code responses', async () => {
|
||||||
nock('http://example.com')
|
nock('http://example.com').persist().get('/bytes/bad').reply(400, {
|
||||||
.persist()
|
|
||||||
.get('/bytes/bad')
|
|
||||||
.reply(400, {
|
|
||||||
username: 'bad',
|
username: 'bad',
|
||||||
password: 'file'
|
password: 'file'
|
||||||
})
|
})
|
||||||
|
@ -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')
|
nock('http://example.com')
|
||||||
.persist()
|
.persist()
|
||||||
.get('/redirect-to')
|
.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(
|
const tempDir = path.join(
|
||||||
__dirname,
|
__dirname,
|
||||||
'test-extract-7z-using-custom-7z-tool'
|
'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')
|
const tempDir = path.join(__dirname, 'test-install-zip')
|
||||||
try {
|
try {
|
||||||
await io.mkdirP(tempDir)
|
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')
|
const tempDir = path.join(__dirname, 'test-install-zip')
|
||||||
try {
|
try {
|
||||||
await io.mkdirP(tempDir)
|
await io.mkdirP(tempDir)
|
||||||
|
@ -762,24 +756,16 @@ describe('@actions/tool-cache', function() {
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
it('works with a 502 temporary failure', async function() {
|
it('works with a 502 temporary failure', async function () {
|
||||||
nock('http://example.com')
|
nock('http://example.com').get('/temp502').twice().reply(502, undefined)
|
||||||
.get('/temp502')
|
nock('http://example.com').get('/temp502').reply(200, undefined)
|
||||||
.twice()
|
|
||||||
.reply(502, undefined)
|
|
||||||
nock('http://example.com')
|
|
||||||
.get('/temp502')
|
|
||||||
.reply(200, undefined)
|
|
||||||
|
|
||||||
const statusCodeUrl = 'http://example.com/temp502'
|
const statusCodeUrl = 'http://example.com/temp502'
|
||||||
await tc.downloadTool(statusCodeUrl)
|
await tc.downloadTool(statusCodeUrl)
|
||||||
})
|
})
|
||||||
|
|
||||||
it("doesn't retry 502s more than 3 times", async function() {
|
it("doesn't retry 502s more than 3 times", async function () {
|
||||||
nock('http://example.com')
|
nock('http://example.com').get('/perm502').times(3).reply(502, undefined)
|
||||||
.get('/perm502')
|
|
||||||
.times(3)
|
|
||||||
.reply(502, undefined)
|
|
||||||
|
|
||||||
expect.assertions(1)
|
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')
|
nock('http://example.com')
|
||||||
.get('/too-many-requests-429')
|
.get('/too-many-requests-429')
|
||||||
.times(2)
|
.times(2)
|
||||||
|
@ -808,13 +794,9 @@ describe('@actions/tool-cache', function() {
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
it("doesn't retry 404", async function() {
|
it("doesn't retry 404", async function () {
|
||||||
nock('http://example.com')
|
nock('http://example.com').get('/not-found-404').reply(404, undefined)
|
||||||
.get('/not-found-404')
|
nock('http://example.com').get('/not-found-404').reply(500, undefined)
|
||||||
.reply(404, undefined)
|
|
||||||
nock('http://example.com')
|
|
||||||
.get('/not-found-404')
|
|
||||||
.reply(500, undefined)
|
|
||||||
|
|
||||||
try {
|
try {
|
||||||
const statusCodeUrl = 'http://example.com/not-found-404'
|
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', {
|
nock('http://example.com', {
|
||||||
reqheaders: {
|
reqheaders: {
|
||||||
authorization: 'token abc123'
|
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', {
|
nock('http://example.com', {
|
||||||
reqheaders: {
|
reqheaders: {
|
||||||
accept: 'application/octet-stream'
|
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', {
|
nock('http://example.com', {
|
||||||
reqheaders: {
|
reqheaders: {
|
||||||
accept: 'application/octet-stream',
|
accept: 'application/octet-stream',
|
||||||
|
|
|
@ -140,10 +140,7 @@ export function _getOsVersion(): string {
|
||||||
(parts[0].trim() === 'VERSION_ID' ||
|
(parts[0].trim() === 'VERSION_ID' ||
|
||||||
parts[0].trim() === 'DISTRIB_RELEASE')
|
parts[0].trim() === 'DISTRIB_RELEASE')
|
||||||
) {
|
) {
|
||||||
version = parts[1]
|
version = parts[1].trim().replace(/^"/, '').replace(/"$/, '')
|
||||||
.trim()
|
|
||||||
.replace(/^"/, '')
|
|
||||||
.replace(/"$/, '')
|
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue