In-Source Tests with Vitest
Vue adopted a Single File Component philosophy, which has some benefits over splitting concerns, which you can read up on in the official Vue Docs. From a SFC philosophy, youโd want everything that relates to your component in a Single File. So letโs explore this take with our component tests as well, because why would your tests be any different than your scripts, template or styles?
Weโre going to leverage a feature that Vitest offers, out of the box, to a Vue example code base. Bear in mind that this approach would be applicable to other implementations that leverage Vitest just as easy. Also, this is a thought experiment.