You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Exploring the testing docs for Svelte and the new experimental test addon (vitest Browser Mode) I have questions.
I want to run some basic component tests in the browser and they need to run setup code to configure (or Mock) the Web Audio, local storage and other browser context (plus clean up after).
I think the story play() functions run Testing Library assertions in the browser? It's not crystal clean.
Docs say both that play() runs after story is rendered and also you can use the mount() function to run code pre and post render?? It's not clear from examples which mount() is used to do this. What in Svelte 5?
It seems the new experimental vitest Browsr Mode addon runs some sort of auto tests - is there an outline of what these actually are?
The experimental addon also runs story play() functions. But are they existing Test LIbrary asserts or does it use vitest browser mode locators and assertions? (hope so).
Looking at ways to run setup code before play functions I see some options are Decorators (not sure how they work in Svelte CSF), Higher order Components, hacking code into the Svlete CSF Story template, or testing fixture features like beforeAll(). I can't see a function to run before stories all in a file. Is there one (and clean up)? Can we guarentee clean up code runs when there are errors in tests or are we left in an indeterminate state?
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
Summary
Exploring the testing docs for Svelte and the new experimental test addon (vitest Browser Mode) I have questions.
I want to run some basic component tests in the browser and they need to run setup code to configure (or Mock) the Web Audio, local storage and other browser context (plus clean up after).
Thanks for any insights
Additional information
No response
Create a reproduction
No response
Beta Was this translation helpful? Give feedback.
All reactions