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:
Thomas Boop
2021-05-21 09:19:40 -04:00
committed by GitHub
parent 8dc2d6eb6a
commit 0d74e9080a
19 changed files with 10148 additions and 12836 deletions

View File

@@ -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 {

View File

@@ -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(),

View File

@@ -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()

View File

@@ -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')
}

View File

@@ -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)

View File

@@ -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)

View File

@@ -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()

View File

@@ -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,

View File

@@ -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)
}

View File

@@ -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

View File

@@ -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

View File

@@ -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
) {

View File

@@ -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()

View File

@@ -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'