From 48f52e092b97209878f3604af2113c2a3154125b Mon Sep 17 00:00:00 2001 From: Mark Erikson Date: Mon, 15 Aug 2022 21:18:35 -0400 Subject: [PATCH] Remove time-sensitive CI test --- .../toolkit/src/query/core/buildThunks.ts | 21 ++++++++++++------- .../toolkit/src/query/tests/cleanup.test.tsx | 9 -------- .../src/query/tests/devWarnings.test.tsx | 7 +++++-- 3 files changed, 19 insertions(+), 18 deletions(-) diff --git a/packages/toolkit/src/query/core/buildThunks.ts b/packages/toolkit/src/query/core/buildThunks.ts index 7ecbca79b7..e873bde369 100644 --- a/packages/toolkit/src/query/core/buildThunks.ts +++ b/packages/toolkit/src/query/core/buildThunks.ts @@ -356,18 +356,25 @@ export function buildThunks< let catchedError = error if (catchedError instanceof HandledError) { let transformErrorResponse: ( - baseQueryReturnValue: any, - meta: any, - arg: any + baseQueryReturnValue: any, + meta: any, + arg: any ) => any = defaultTransformResponse - if (endpointDefinition.query && endpointDefinition.transformErrorResponse) { + if ( + endpointDefinition.query && + endpointDefinition.transformErrorResponse + ) { transformErrorResponse = endpointDefinition.transformErrorResponse } try { return rejectWithValue( - await transformErrorResponse(catchedError.value, catchedError.meta, arg.originalArgs), - { baseQueryMeta: catchedError.meta } + await transformErrorResponse( + catchedError.value, + catchedError.meta, + arg.originalArgs + ), + { baseQueryMeta: catchedError.meta } ) } catch (e) { catchedError = e @@ -375,7 +382,7 @@ export function buildThunks< } if ( typeof process !== 'undefined' && - process.env.NODE_ENV === 'development' + process.env.NODE_ENV !== 'production' ) { console.error( `An unhandled error occurred processing a request for the endpoint "${arg.endpointName}". diff --git a/packages/toolkit/src/query/tests/cleanup.test.tsx b/packages/toolkit/src/query/tests/cleanup.test.tsx index 5aebc49758..e9b9b95992 100644 --- a/packages/toolkit/src/query/tests/cleanup.test.tsx +++ b/packages/toolkit/src/query/tests/cleanup.test.tsx @@ -177,8 +177,6 @@ test('Minimizes the number of subscription dispatches when multiple components a return <>{listItems} } - const start = Date.now() - render(, { wrapper: storeRef.wrapper, }) @@ -189,10 +187,6 @@ test('Minimizes the number of subscription dispatches when multiple components a return screen.getAllByText(/42/).length > 0 }) - const end = Date.now() - - const timeElapsed = end - start - const subscriptions = getSubscriptionsA() expect(Object.keys(subscriptions!).length).toBe(NUM_LIST_ITEMS) @@ -203,7 +197,4 @@ test('Minimizes the number of subscription dispatches when multiple components a // 'api/executeQuery/fulfilled' // ] expect(actionTypes.length).toBe(4) - // Could be flaky in CI, but we'll see. - // Currently seeing 1000ms in local dev, 6300 without the batching fixes - expect(timeElapsed).toBeLessThan(2500) }, 25000) diff --git a/packages/toolkit/src/query/tests/devWarnings.test.tsx b/packages/toolkit/src/query/tests/devWarnings.test.tsx index c52f46dea6..5dbd22a6fa 100644 --- a/packages/toolkit/src/query/tests/devWarnings.test.tsx +++ b/packages/toolkit/src/query/tests/devWarnings.test.tsx @@ -346,8 +346,11 @@ In the case of an unhandled error, no tags will be "provided" or "invalidated". return { error: {} } }, endpoints: (build) => ({ - transformErRspn: build.query({ - query() {}, + // @ts-ignore TS doesn't like `() => never` for `tER` + transformErRspn: build.query({ + // @ts-ignore TS doesn't like `() => never` for `tER` + query: () => '/dummy', + // @ts-ignore TS doesn't like `() => never` for `tER` transformErrorResponse() { throw new Error('this was kinda expected') },