queryClient.tsx 690 B

1234567891011121314151617181920212223242526
  1. import {QueryClient} from '@tanstack/react-query';
  2. import merge from 'lodash/merge';
  3. import {DEFAULT_QUERY_CLIENT_CONFIG} from 'sentry/utils/queryClient';
  4. export const makeTestQueryClient = () =>
  5. new QueryClient(
  6. merge({}, DEFAULT_QUERY_CLIENT_CONFIG, {
  7. defaultOptions: {
  8. queries: {
  9. // Disable retries for tests to allow them to fail fast
  10. retry: false,
  11. },
  12. mutations: {
  13. // Disable retries for tests to allow them to fail fast
  14. retry: false,
  15. },
  16. },
  17. // Don't want console output in tests
  18. logger: {
  19. log: () => {},
  20. warn: () => {},
  21. error: () => {},
  22. },
  23. })
  24. );