Open ambrt opened 3 years ago
The sourcemaps for svelte in snowpack are incorrect. This way istanbul can't calculate coverage correctly. I filed an issue for this: https://github.com/snowpackjs/snowpack/discussions/2543
putting it here, i feel it is related to the OP's topic.
as web test runner uses istanbul to lookup for source file. after generating the coverage results.. i am unable to view the coverage report as the files are being served via in-memory location _dist_
folder (snowpack serve's it from there).. however istanbul expects the file source to be on fs
.
hopefully following Screenshot explains what i am trying to say.
In my case.. coverage is 80% percent.. so i guess issues are unrelated.. sorry for polluting this thread.. will create new one
To have visible coverage of .svelte files, sourcemap have to be enable in buildOptions of snowpack. Its latest fix for earlier bug.
When it is enabled it, incorrectly reports 100% of coverage just by including tested component. And it doesn't increment coverage with testing elements.
Below is fork from example-projects of modern web that shows it.
https://github.com/ambrt/example-projects/tree/master/snowpack-svelte