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

test-setup.ts

14 lines442 Bytes

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