Example code for the blog post at https://ph-fritsche.github.io/blog/post/react-act
git clone https://github.com/ph-fritsche/example-react-act.git
cd example-react-act
yarn
yarn start
yarn test
Edit src/MyCounter.test.tsx:
vi.spyOn(defaultStore, 'sync')
.mockImplementationOnce(() => Promise.resolve()
// Just enough microtasks for this setup.
// Comment this out to add a warning.
.then(() => void 0)
.then(() => void 0)
)