diff --git a/package.json b/package.json index b7000ec1424..780349296bf 100644 --- a/package.json +++ b/package.json @@ -56,7 +56,7 @@ "ignore-styles": "^5.0.1", "jest": "^26.6.3", "lerna": "^3.22.1", - "nock": "^13.0.6", + "nock": "^13.0.7", "prettier": "^2.2.1", "react": "17.0.1", "react-dom": "17.0.1", @@ -76,7 +76,7 @@ "ts-node": "^9.1.1", "ttypescript": "^1.5.12", "typescript": "^4.1.3", - "whatwg-fetch": "3.0.0" + "whatwg-fetch": "3.6.1" }, "resolutions": { "@lerna/conventional-commits": "https://github.com/ntucker/lerna-conventional-commits.git" diff --git a/packages/core/src/react-integration/__tests__/integration-endpoint.web.tsx b/packages/core/src/react-integration/__tests__/integration-endpoint.web.tsx index 87b65215554..104abf36096 100644 --- a/packages/core/src/react-integration/__tests__/integration-endpoint.web.tsx +++ b/packages/core/src/react-integration/__tests__/integration-endpoint.web.tsx @@ -664,7 +664,7 @@ for (const makeProvider of [makeCacheProvider, makeExternalCacheProvider]) { }), ); - // second optimistic + // third optimistic mynock .patch('/article-cooler/5') .delay(500) diff --git a/packages/endpoint/src/__tests__/endpoint.ts b/packages/endpoint/src/__tests__/endpoint.ts index 105065eddce..fe0953c5bdd 100644 --- a/packages/endpoint/src/__tests__/endpoint.ts +++ b/packages/endpoint/src/__tests__/endpoint.ts @@ -418,10 +418,10 @@ describe('Endpoint', () => { expect(user.username).toBe(payload.username); }); - it('should reject when aborted', () => { + it('should reject when aborted', async () => { const abort = new AbortController(); const AbortUser = UserDetail.extend({ signal: abort.signal }); - expect(async () => { + await expect(async () => { const promise = AbortUser({ id: payload.id }); abort.abort(); return await promise; diff --git a/packages/hooks/src/__tests__/useCancelling.ts b/packages/hooks/src/__tests__/useCancelling.ts index bf3d6d166a6..9046d5b4b38 100644 --- a/packages/hooks/src/__tests__/useCancelling.ts +++ b/packages/hooks/src/__tests__/useCancelling.ts @@ -34,6 +34,10 @@ describe('useCancelling()', () => { .delay(2000) .reply(200, payload2); }); + afterAll(() => { + jest.useRealTimers(); + nock.cleanAll(); + }); it('should abort when props change and resolve when kept the same', async () => { const { result, rerender } = renderHook( @@ -50,7 +54,7 @@ describe('useCancelling()', () => { expect(ogPromise).rejects.toMatchInlineSnapshot(`[AbortError: Aborted]`); const nextPromise = result.current({ id: '7' }); jest.advanceTimersByTime(2000); - await expect(nextPromise).resolves.toMatchInlineSnapshot(` + expect(nextPromise).resolves.toMatchInlineSnapshot(` Object { "id": "7", "title": "second one", diff --git a/yarn.lock b/yarn.lock index 11839d7ae87..553873aec09 100644 --- a/yarn.lock +++ b/yarn.lock @@ -9912,10 +9912,10 @@ nocache@^2.1.0: resolved "https://registry.yarnpkg.com/nocache/-/nocache-2.1.0.tgz#120c9ffec43b5729b1d5de88cd71aa75a0ba491f" integrity sha512-0L9FvHG3nfnnmaEQPjT9xhfN4ISk0A8/2j4M37Np4mcDesJjHgEUfgPhdCyZuFI954tjokaIj/A3NdpFNdEh4Q== -nock@^13.0.6: - version "13.0.9" - resolved "https://registry.yarnpkg.com/nock/-/nock-13.0.9.tgz#32b9f6408a71991b25f044109cac92ee556c8539" - integrity sha512-SoGx/J0SsZPOdBFrBC9PP6NwaEgOBQIRPbsOsO9q+OwOPWc5eT6wALSxn3ZNE4Fv2ImIUXM4Hv/07rjq/uWDew== +nock@^13.0.7: + version "13.0.7" + resolved "https://registry.yarnpkg.com/nock/-/nock-13.0.7.tgz#9bc718c66bd0862dfa14601a9ba678a406127910" + integrity sha512-WBz73VYIjdbO6BwmXODRQLtn7B5tldA9pNpWJe5QTtTEscQlY5KXU4srnGzBOK2fWakkXj69gfTnXGzmrsaRWw== dependencies: debug "^4.1.0" json-stringify-safe "^5.0.1" @@ -13650,7 +13650,12 @@ whatwg-encoding@^1.0.5: dependencies: iconv-lite "0.4.24" -whatwg-fetch@3.0.0, whatwg-fetch@>=0.10.0, whatwg-fetch@^3.0.0: +whatwg-fetch@3.6.1: + version "3.6.1" + resolved "https://registry.yarnpkg.com/whatwg-fetch/-/whatwg-fetch-3.6.1.tgz#93bc4005af6c2cc30ba3e42ec3125947c8f54ed3" + integrity sha512-IEmN/ZfmMw6G1hgZpVd0LuZXOQDisrMOZrzYd5x3RAK4bMPlJohKUZWZ9t/QsTvH0dV9TbPDcc2OSuIDcihnHA== + +whatwg-fetch@>=0.10.0, whatwg-fetch@^3.0.0: version "3.0.0" resolved "https://registry.yarnpkg.com/whatwg-fetch/-/whatwg-fetch-3.0.0.tgz#fc804e458cc460009b1a2b966bc8817d2578aefb" integrity sha512-9GSJUgz1D4MfyKU7KRqwOjXCXTqWdFNvEr7eUBYchQiVc744mqK/MzXPNR2WsPkmkOa4ywfg8C2n8h+13Bey1Q==