From d445878917ab352c6786b95c5d572b723472426c Mon Sep 17 00:00:00 2001 From: Thomas Boop <52323235+thboop@users.noreply.github.com> Date: Fri, 21 May 2021 09:19:40 -0400 Subject: [PATCH] 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 --- __tests__/downloadUtils.test.ts | 7 ++++--- __tests__/requestUtils.test.ts | 1 - __tests__/restoreCache.test.ts | 1 - __tests__/saveCache.test.ts | 1 - src/internal/downloadUtils.ts | 2 +- src/internal/requestUtils.ts | 2 +- 6 files changed, 6 insertions(+), 8 deletions(-) diff --git a/__tests__/downloadUtils.test.ts b/__tests__/downloadUtils.test.ts index c5179d3..4cc089a 100644 --- a/__tests__/downloadUtils.test.ts +++ b/__tests__/downloadUtils.test.ts @@ -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() diff --git a/__tests__/requestUtils.test.ts b/__tests__/requestUtils.test.ts index 0119734..7509d04 100644 --- a/__tests__/requestUtils.test.ts +++ b/__tests__/requestUtils.test.ts @@ -30,7 +30,6 @@ async function handleResponse( response: ITestResponse | undefined ): Promise { if (!response) { - // eslint-disable-next-line no-undef fail('Retry method called too many times') } diff --git a/__tests__/restoreCache.test.ts b/__tests__/restoreCache.test.ts index 72d6ead..cb3a06c 100644 --- a/__tests__/restoreCache.test.ts +++ b/__tests__/restoreCache.test.ts @@ -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) diff --git a/__tests__/saveCache.test.ts b/__tests__/saveCache.test.ts index 99ff97e..22fcbd9 100644 --- a/__tests__/saveCache.test.ts +++ b/__tests__/saveCache.test.ts @@ -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) diff --git a/src/internal/downloadUtils.ts b/src/internal/downloadUtils.ts index 0aebd78..44cf7f3 100644 --- a/src/internal/downloadUtils.ts +++ b/src/internal/downloadUtils.ts @@ -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() diff --git a/src/internal/requestUtils.ts b/src/internal/requestUtils.ts index cce9661..2a8ba93 100644 --- a/src/internal/requestUtils.ts +++ b/src/internal/requestUtils.ts @@ -120,7 +120,7 @@ export async function retryTypedResponse( ) } -export async function retryHttpClientResponse( +export async function retryHttpClientResponse( name: string, method: () => Promise, maxAttempts = DefaultRetryAttempts,