Skip to content
Advertisement

Tag: testing-library

Cannot find module ‘react’ when use third party React UI lib – Vite + Preact

I’m facing this issue in this Vite started repository. https://github.com/vicainelli/vite-starter I’m using Vite + Preact + Vitest + Testing Library If I’m testing any code inside the codebase, it works fine, but If the test runs against some component that uses another component from an external library, I’m getting this error. This is something similar to this issue, but I’m

Preventing “not wrapped in act(…)” Jest warning when state update doesn’t affect UI

I’m trying to figure out if there is a way to prevent the “not wrapped in act(…)” warning thrown by Jest/testing-library when I have nothing to assert after the state update that causes the warning happens, or if I should just ignore this warning. Suppose I have this simple component: Suppose I want to simply test that this component renders

Advertisement