The following is an abstraction of my problem and thus does not make too much sense: Given I have a simple utility callMethodIf that’s returning the return of another imported method (blackbox). ~~/utils/call-method-if.js: ~~/utils/blackbox.js: How would I run one test case which calls the actual implem…
Tag: vitest
How to clear/reset mocks in Vitest
I have a simple composable useRoles which I need to test My approach of testing it is the following And useStore is just a simple function that I intended to mock The first test runs successfully, it has all the mock values I implemented but the problem is that it’s not resetting for each test (not rese…
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 ext…