ItalyPaleAle / svelte-spa-router

Router for SPAs using Svelte 3
MIT License
1.55k stars 106 forks source link

[cross] svelte-testing-library failing with dinamically imported components #252

Closed absinthetized closed 2 years ago

absinthetized commented 2 years ago

hello,

I've opened a ticket on testing library here a week ago. no response yet.

it seems that testing library doesn't like some sintax in a component with dynamically generated routes. Honestly the error is too obscure for me. I can say that running the app I see no issue at all, that's 90% an issue on the testing library side but I do not understand if I can fix it via some preprocessing setup in rollup or similar...

maybe the linked error is more self-explanatory to you. If you dislike this explicit cross-ref, please close the ticket. no hard feelings :)

Thank you.

ItalyPaleAle commented 2 years ago

Hi @absinthetized I have looked into it, and the first thing that comes to my mind is that the testing library (which I admit I'm not familiar with at all) does not support compiling Svelte files, or at least doesn't compile .svelte files within node_modules.

This router ships only "raw" .svelte files, which are then meant to be compiled as part of your application. This is to follow recommended practices as it allows for better compatibility, potentially smaller code, etc.

I'm afraid it's an issue that needs to be fixed by the testing library downstream.

absinthetized commented 2 years ago

thanks a lot. even removing dynamic imports (internal tests not published) I get the same issue. it seems some preprocessing in testing library doesn't handle the nested component scenario