Skip to content
Source
Sign inSign up
TanStack/query
Open History to see the last commit

test-setup.ts

16 lines535 Bytes

1import '@testing-library/jest-dom/vitest'
2import { act, cleanup as cleanupRTL } from '@testing-library/react'
3import { cleanup as cleanupRRS } from '@testing-library/react-render-stream'
4import { afterEach } from 'vitest'
5import { notifyManager } from '@tanstack/query-core'
6​
7// https://testing-library.com/docs/react-testing-library/api#cleanup
8afterEach(() => {
9 cleanupRTL()
10 cleanupRRS()
11})
12​
13// Wrap notifications with act to make sure React knows about React Query updates
14notifyManager.setNotifyFunction((fn) => {
15 act(fn)
16})