Replies: 2 comments
-
Hey @apirak, why do you prefer using Vitest over Japa? I think Japa would provide a better user experience. |
Beta Was this translation helpful? Give feedback.
0 replies
-
Thank you Muco, Our other projects using Vitest. To use a single testing framework minimizes context switching for our team 🙇♂️ |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
I am currently working on testing AdonisJS 6 using Vitest instead of the official Japa framework. While unit testing with mocked models works fine, I encounter issues when attempting to perform E2E tests involving real database interactions through models.
✅ Unit Test (Works as Expected)
I can successfully mock and test model behavior like this:
❌ E2E Test (Fails with TypeError)
However, when I try to test real database interactions (e.g., save() method), I encounter this error:
Error Message
TypeError: Cannot read properties of undefined (reading 'insert')
🙇♂️ Question:
Do I need to initialize the database connection differently for Vitest? Or is there a workaround to make model operations (e.g., save(), query()) work correctly during tests?
Any guidance or best practices would be greatly appreciated! 🙏✨
Beta Was this translation helpful? Give feedback.
All reactions