mirror of
https://git.mirrors.martin98.com/https://github.com/actions/toolkit
synced 2026-05-04 10:28:05 +08:00
Re-enable the audit tools step and update dependencies (#815)
* update package versions * run audit * fix eslint config * linter updates * re-enable audit * update timeouts test * pass done into callback * fix format
This commit is contained in:
@@ -357,7 +357,7 @@ describe('Download Tests', () => {
|
||||
plaintext: Buffer | string
|
||||
): Promise<Buffer> {
|
||||
if (isGzip) {
|
||||
return <Buffer>await promisify(gzip)(plaintext)
|
||||
return await promisify(gzip)(plaintext)
|
||||
} else if (typeof plaintext === 'string') {
|
||||
return Buffer.from(plaintext, defaultEncoding)
|
||||
} else {
|
||||
|
||||
@@ -69,7 +69,7 @@ export async function retry(
|
||||
throw Error(`${name} failed: ${errorMessage}`)
|
||||
}
|
||||
|
||||
export async function retryHttpClientRequest<T>(
|
||||
export async function retryHttpClientRequest(
|
||||
name: string,
|
||||
method: () => Promise<IHttpClientResponse>,
|
||||
customErrorMessages: Map<number, string> = new Map(),
|
||||
|
||||
@@ -87,7 +87,7 @@ test('download progress tracked correctly', () => {
|
||||
expect(progress.isDone()).toBe(true)
|
||||
})
|
||||
|
||||
test('display timer works correctly', () => {
|
||||
test('display timer works correctly', done => {
|
||||
const progress = new DownloadProgress(1000)
|
||||
|
||||
const infoMock = jest.spyOn(core, 'info')
|
||||
@@ -103,6 +103,7 @@ test('display timer works correctly', () => {
|
||||
const test2 = (): void => {
|
||||
check()
|
||||
expect(progress.timeoutHandle).toBeUndefined()
|
||||
done()
|
||||
}
|
||||
|
||||
// Validate the progress is displayed, stop the timer, and call test2.
|
||||
@@ -112,7 +113,7 @@ test('display timer works correctly', () => {
|
||||
progress.stopDisplayTimer()
|
||||
progress.setReceivedBytes(1000)
|
||||
|
||||
setTimeout(() => test2(), 100)
|
||||
setTimeout(() => test2(), 500)
|
||||
}
|
||||
|
||||
// Start the timer, update the received bytes, and call test1.
|
||||
@@ -122,7 +123,7 @@ test('display timer works correctly', () => {
|
||||
|
||||
progress.setReceivedBytes(500)
|
||||
|
||||
setTimeout(() => test1(), 100)
|
||||
setTimeout(() => test1(), 500)
|
||||
}
|
||||
|
||||
start()
|
||||
|
||||
@@ -30,7 +30,6 @@ async function handleResponse(
|
||||
response: ITestResponse | undefined
|
||||
): Promise<ITestResponse> {
|
||||
if (!response) {
|
||||
// eslint-disable-next-line no-undef
|
||||
fail('Retry method called too many times')
|
||||
}
|
||||
|
||||
|
||||
@@ -18,7 +18,6 @@ beforeAll(() => {
|
||||
jest.spyOn(core, 'warning').mockImplementation(() => {})
|
||||
jest.spyOn(core, 'error').mockImplementation(() => {})
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/promise-function-async
|
||||
jest.spyOn(cacheUtils, 'getCacheFileName').mockImplementation(cm => {
|
||||
const actualUtils = jest.requireActual('../src/internal/cacheUtils')
|
||||
return actualUtils.getCacheFileName(cm)
|
||||
|
||||
1
packages/cache/__tests__/saveCache.test.ts
vendored
1
packages/cache/__tests__/saveCache.test.ts
vendored
@@ -17,7 +17,6 @@ beforeAll(() => {
|
||||
jest.spyOn(core, 'warning').mockImplementation(() => {})
|
||||
jest.spyOn(core, 'error').mockImplementation(() => {})
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/promise-function-async
|
||||
jest.spyOn(cacheUtils, 'getCacheFileName').mockImplementation(cm => {
|
||||
const actualUtils = jest.requireActual('../src/internal/cacheUtils')
|
||||
return actualUtils.getCacheFileName(cm)
|
||||
|
||||
2
packages/cache/src/internal/downloadUtils.ts
vendored
2
packages/cache/src/internal/downloadUtils.ts
vendored
@@ -133,7 +133,7 @@ export class DownloadProgress {
|
||||
*
|
||||
* @param delayInMs the delay between each write
|
||||
*/
|
||||
startDisplayTimer(delayInMs: number = 1000): void {
|
||||
startDisplayTimer(delayInMs = 1000): void {
|
||||
const displayCallback = (): void => {
|
||||
this.display()
|
||||
|
||||
|
||||
2
packages/cache/src/internal/requestUtils.ts
vendored
2
packages/cache/src/internal/requestUtils.ts
vendored
@@ -120,7 +120,7 @@ export async function retryTypedResponse<T>(
|
||||
)
|
||||
}
|
||||
|
||||
export async function retryHttpClientResponse<T>(
|
||||
export async function retryHttpClientResponse(
|
||||
name: string,
|
||||
method: () => Promise<IHttpClientResponse>,
|
||||
maxAttempts = DefaultRetryAttempts,
|
||||
|
||||
@@ -29,7 +29,7 @@ export function issueCommand(
|
||||
process.stdout.write(cmd.toString() + os.EOL)
|
||||
}
|
||||
|
||||
export function issue(name: string, message: string = ''): void {
|
||||
export function issue(name: string, message = ''): void {
|
||||
issueCommand(name, {}, message)
|
||||
}
|
||||
|
||||
|
||||
@@ -619,13 +619,13 @@ class ExecState extends events.EventEmitter {
|
||||
}
|
||||
}
|
||||
|
||||
processClosed: boolean = false // tracks whether the process has exited and stdio is closed
|
||||
processError: string = ''
|
||||
processExitCode: number = 0
|
||||
processExited: boolean = false // tracks whether the process has exited
|
||||
processStderr: boolean = false // tracks whether stderr was written to
|
||||
processClosed = false // tracks whether the process has exited and stdio is closed
|
||||
processError = ''
|
||||
processExitCode = 0
|
||||
processExited = false // tracks whether the process has exited
|
||||
processStderr = false // tracks whether stderr was written to
|
||||
private delay = 10000 // 10 seconds
|
||||
private done: boolean = false
|
||||
private done = false
|
||||
private options: im.ExecOptions
|
||||
private timeout: NodeJS.Timer | null = null
|
||||
private toolPath: string
|
||||
|
||||
@@ -2,6 +2,7 @@ import * as path from 'path'
|
||||
import {Context} from '../src/context'
|
||||
|
||||
/* eslint-disable @typescript-eslint/no-require-imports */
|
||||
/* eslint-disable @typescript-eslint/no-var-requires */
|
||||
|
||||
describe('@actions/context', () => {
|
||||
let context: Context
|
||||
|
||||
@@ -48,10 +48,6 @@ export class Pattern {
|
||||
*/
|
||||
private readonly isImplicitPattern: boolean
|
||||
|
||||
/* eslint-disable no-dupe-class-members */
|
||||
// Disable no-dupe-class-members due to false positive for method overload
|
||||
// https://github.com/typescript-eslint/typescript-eslint/issues/291
|
||||
|
||||
constructor(pattern: string)
|
||||
constructor(
|
||||
pattern: string,
|
||||
@@ -67,7 +63,7 @@ export class Pattern {
|
||||
)
|
||||
constructor(
|
||||
patternOrNegate: string | boolean,
|
||||
isImplicitPattern: boolean = false,
|
||||
isImplicitPattern = false,
|
||||
segments?: string[],
|
||||
homedir?: string
|
||||
) {
|
||||
|
||||
@@ -33,7 +33,7 @@ export async function exists(fsPath: string): Promise<boolean> {
|
||||
|
||||
export async function isDirectory(
|
||||
fsPath: string,
|
||||
useStat: boolean = false
|
||||
useStat = false
|
||||
): Promise<boolean> {
|
||||
const stats = useStat ? await stat(fsPath) : await lstat(fsPath)
|
||||
return stats.isDirectory()
|
||||
|
||||
@@ -122,11 +122,9 @@ describe('@actions/tool-cache', function() {
|
||||
|
||||
setResponseMessageFactory(() => {
|
||||
const readStream = new stream.Readable()
|
||||
/* eslint-disable @typescript-eslint/unbound-method */
|
||||
readStream._read = () => {
|
||||
readStream.destroy(new Error('uh oh'))
|
||||
}
|
||||
/* eslint-enable @typescript-eslint/unbound-method */
|
||||
return readStream
|
||||
})
|
||||
|
||||
@@ -149,7 +147,6 @@ describe('@actions/tool-cache', function() {
|
||||
.get('/retries-error-from-response-message-stream')
|
||||
.reply(200, {})
|
||||
|
||||
/* eslint-disable @typescript-eslint/unbound-method */
|
||||
let attempt = 1
|
||||
setResponseMessageFactory(() => {
|
||||
const readStream = new stream.Readable()
|
||||
@@ -170,7 +167,6 @@ describe('@actions/tool-cache', function() {
|
||||
|
||||
return readStream
|
||||
})
|
||||
/* eslint-enable @typescript-eslint/unbound-method */
|
||||
|
||||
const downPath = await tc.downloadTool(
|
||||
'http://example.com/retries-error-from-response-message-stream'
|
||||
|
||||
Reference in New Issue
Block a user