title: Why doesn't react-query produce a value in my Jest test?
body: <p>I believe I followed <a href="https://tanstack.com/query/v4/docs/guides/testing?from=reactQueryV3&amp;original=https://react-query-v3.tanstack.com/guides/testing" rel="nofollow noreferrer">the docs</a> in how I implementing the test, and yet it fails due a timeout.</p>
  <p>It always says it is loading, but the function is returning immediately (whether it returns a promise or a value seems to not make a difference).</p>
  <pre><code>import React from 'react';
  
  import { useInfiniteQuery, QueryClientProvider, QueryClient, useQuery } from '@tanstack/react-query' 
  import { renderHook, act } from '@testing-library/react-hooks'
  
  function useCustomInfinuteHook() { // Not using this, but it doesn't work either
      return useInfiniteQuery([], () =&gt; {
          return Math.random();
      }, {
          getNextPageParam() {
              return 2
          }
      }) 
  }
  export function useCustomHook() {
      return useQuery(['customHook'], async () =&gt; Promise.resolve('Hello'));
    }
  
    const queryClient = new QueryClient({
      defaultOptions: {
        queries: {
          // ✅ turns retries off
          retry: false,
        },
      },
    })
  const wrapper = ({ children }: any) =&gt; (
      &lt;QueryClientProvider client={queryClient}&gt;
        {children}
      &lt;/QueryClientProvider&gt;
    );
    
    
  test(&quot;React Query?&quot;, async () =&gt; {
      const { result: { current }, waitForValueToChange, waitForNextUpdate } = renderHook(() =&gt; useCustomHook(), {
          // Wraps hook in a react-query provider
          wrapper
      })
      
      expect(current.isLoading).toBeTruthy();
      await waitForValueToChange(() =&gt; current.isLoading, { timeout: 10000}); // Throws error due to timeout
      expect(current.isLoading).toBeFalsy();
  }, 10000)
  </code></pre>
  <p>Outputs:</p>
  <pre><code>● React Query?
  
      thrown: &quot;Exceeded timeout of 10000 ms for a test.
      Use jest.setTimeout(newTimeout) to increase the timeout value, if this is a long-running test.&quot;
  
        32 |   
        33 |   
      &gt; 34 | test(&quot;React Query?&quot;, async () =&gt; {
           | ^
        35 |     const { result: { current }, waitForValueToChange } = renderHook(() =&gt; useCustomHook(), {
        36 |         // Wraps hook in a react-query provider
        37 |         wrapper
  
        at Object.&lt;anonymous&gt; (src/queries/testquery.test.tsx:34:1)
  </code></pre>