Convex-test and React-Native
Given react-native compatibility with vitest is experimental and convex-test recommends to use vitest, has someone been able to use convex-test with React-Native? Eventually by using jest?
10 Replies
Since convex-test only touches server-side code, I bet using vitest just works; it never imports client react-native code.
convex-test
should also work with jest
(or any other JS unit test framework) if you want to use the same test framework everywhereSorry, I have struggled using both approaches and those are usually problems that I hate to deal with related to bundler/esm/commonjs.
Setting a jest test for convex on a blank rn app gives the following:

My intuition is that react-native being bundled by metro somehow has a "configuration mismatch" with the convex-test package
And with Vitest, it looks like the imports are completely wrong. It tries to find "emails" relative to the
node-modules/convex-test
folder because api.d.ts
generated by convex has the import type * from "../email.js"


@Riki can you try to downgrade convex-test to the previous version and see if it resolves the vitest issue?
Oh nice this works!
I can confirm tests (and imports under the hood) are working correctly with
convex-test: 0.0.12
Many thanks to the team for your help 🙏One last thing tough, sorry to bother, but it looks like the vitest code coverage tool isn't reporting at all convex source files (with TypeScript). Would you know how to fix this please? I assume this is related to the fact that convex "generates" files

Ah, this is another impact of us using dynamic imports to perform the api.foo.bar calls.
Will see what we can do about it.
Alright 👌 At least the most important issue I had with running tests is fixed. Thanks again @Michal Srb