I'm not sure if testing-library is well supported still
2024-12-12
In my personal projects, I like to use Svelte and at work we are using Vue.js. Both suggest to use testing-library, a library that helps in testing components, and which exists for both Svelte and Vue.js. Svelte suggests it here in its docs, and Vue.js here in its docs.
Vue.js already mentions that they don't necessarily recommend the library:
We recommend using @vue/test-utils for testing components in applications. @testing-library/vue has issues with testing asynchronous component with Suspense, so it should be used with caution.
From my experience, I can also say that I didn't have good experiences using the library.
In general, I like its ideas very much. I would very much like a simple, low-overhead library to test components. Unfortunately, it seems like the library is not well maintained, at least not for roughly a year.
At the moment of this writing, vue-testing-library, for example, had its last commit 7 months ago.
More specifically, however, I tried it out once with Svelte and pretty quickly stumbled upon issues. The testing-library is itself using user-event. That, however, seems unmaintained. When I used the library, I had a very similar problem as described in that GitHub issue.
I'm not writing this down to diminish the library. Im writing this primarily as a note to myself that the library seems unmaintained, and that it's probably better to go with another library. I also don't like that both Vue.js and Svelte link to it, even though it really doesn't feel maintained.
Today, I had exactly the need of picking a library for testing, as I am currently looking for what to use for component testing in Vue.js. I guess I will probably try out @vue/test-utils, as they suggest this themselves even. An initial test I wrote worked really well.