-
-
Notifications
You must be signed in to change notification settings - Fork 4.5k
invalid_snippet_arguments
when rendering snippet using render function from @testing-library/svelte
#15760
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
AFAIK |
@dummdidumm thanks for your feedback. There is no mention of Svelte Snippets in the
What would be for you the right way to test Snippets in an unitary manner ? The only alternative that I can imagine would be to create a Svelte Wrapper Component. Which would add a lot of code for this testing that was made pretty easy before.
Technically you are probably right, the error is accurate, the More generally speaking, this echo a lot with #9774 and the Component and Snippet are getting more and more two distinct entities, and it get hard to play with both of them. Especially with the lack of method to tell them appart. I am not a big fan of #9774 (comment) which is more a hack than an actual solution with long term support. We have a lot of places in our codebase where we allow either a Snippet or a Component, not being able to render either of them with a single method (E.g. |
@dummdidumm nope, not a valid use-case for
@axel7083 yes, you probably need a wrapper component. You can create one fixture to use with multiple snippets - see my suggestion in the STL thread you posted in |
Thanks @mcous , just to summarise our discussion in testing-library/svelte-testing-library#284 (comment) With the current API exposed, it does not seems it is possible to create a generic |
Describe the bug
Using vitest, and @testing-library/svelte in our codebase we were testing Snippets in different area using the
render
function from the testing library (see reproduction).Recently with #15521 it has been added some extra validation when rendering Snippet. And our CI failed when dependabot tried to update svelte library.
The problem seems to be that the testing library calls the Snippet function with an empty object as argument, and fails at the following part of the code
svelte/packages/svelte/src/internal/client/dev/validation.js
Lines 10 to 14 in e72ac0f
Raising an invalid_snippet_arguments error.
Reproduction
Example.svelte
example.spec.ts
Logs
System Info
Severity
blocking an upgrade
The text was updated successfully, but these errors were encountered: