-
-
Notifications
You must be signed in to change notification settings - Fork 80
Description
I just ran sv add vitest on an existing site and was slightly surprised to see it create src/routes/page.svelte.spec.ts. For one thing, the test it contained didn't pass, because it was making assumptions that might hold true for a freshly-baked app but won't necessarily hold true for existing apps.
But also: it feels weird to test components like +page.svelte. We don't know what props it might accept, or how it might interact with the layout, etc — if I want to test what happens when I visit / or any other route, that's really a job for an e2e test. I would typically expect a component test to belong to something in lib.
What if we created something like src/lib/Demo.svelte and src/lib/Demo.svelte.spec.ts instead? Maybe demo.spec.ts should go in lib too? (and also have a corresponding demo.ts module? It's slightly odd that the demo test isn't actually testing anything)