modernweb-dev / web

Guides, tools and libraries for modern web development.
https://modern-web.dev
MIT License
2.22k stars 289 forks source link

Test runner incorrectly reports 100% coverage when sourcemap is enabled in snowpack. #1247

Open ambrt opened 3 years ago

ambrt commented 3 years ago

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

LarsDenBakker commented 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

Manish3323 commented 3 years ago

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.

Screenshot 2021-02-23 at 1 31 03 PM

In my case.. coverage is 80% percent.. so i guess issues are unrelated.. sorry for polluting this thread.. will create new one