Open cuiqui opened 3 years ago
Does it work with other imported svelte components?
Personally, I have never used jest for testing svelte components.
It works for some libraries, but I had similar problems with one or two, including this one. Jest was not compiling the library before running the test on the one hand, so I instruct it to do it with:
transformIgnorePatterns: [
'node_modules/(?!fa-svelte/)'
]
But, on the other hand, since the default exported element is not a Svelte component, I had to directly import fa-svelte/src/Icon.svelte
(don't know if it's the best solution, but it's the only one that worked for me). Later I found that it had already happened for another library, you can check this answer in SO if interested.
Thanks for the answer, I think we can close the issue tho.
Hello, I don't know if this is the right place to post it; of course, let me know if this is not your problem. Jest is complaining when I'm trying to test a Svelte component which includes an
Icon
throughfa-svelte
. Relevant parts are:This would be the simplified component, let's call it
Example.svelte
Then my test
Example.test.js
is something like:This results in aforementioned error:
Just in case, this is my Jest configuration:
Any insights as to what's going on? Thanks very much in advanced.
EDIT: I'm using
"fa-svelte": "^3.1.0"