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.