rusk icon indicating copy to clipboard operation
rusk copied to clipboard

Gain a reliable code coverage in Svelte components

Open ascartabelli opened this issue 1 year ago • 4 comments

Summary

Coverage seems quite unreliable in Svelte components with vitest, see:

  • https://github.com/vitest-dev/vitest/issues/1893
  • https://github.com/vitest-dev/vitest/issues/1423

Maybe experiment with istanbul as provider instead of v8.

ascartabelli avatar Nov 08 '23 10:11 ascartabelli

A very quick experiment with istanbul seems to indicate that we will have better coverage for event handlers and such, but many problems still remain on the markup portion of the component.

ascartabelli avatar Nov 16 '23 06:11 ascartabelli

Vitest update its coverage providers (both v8 and istanbul) to v.1.x.

The situation is still puzzling; I'll attach some screenshots from the coverage of one component to illustrate the situation.

using v8 without testing the event handlers: Screenshot 2023-12-08 alle 10 27 25

using v8 adding the event handlers tests:

Screenshot 2023-12-08 alle 10 28 19

using istanbul without testing the event handlers: Screenshot 2023-12-08 alle 10 29 05

using istanbul adding the event handlers tests:

Screenshot 2023-12-08 alle 10 29 46

ascartabelli avatar Dec 08 '23 09:12 ascartabelli

Let's keep an eye on it. Having reliable coverage would be a great boon.

kieranhall avatar Dec 08 '23 17:12 kieranhall

This issue appears to be connected to our pain with coverage reporting... https://github.com/sveltejs/svelte/issues/7824

kieranhall avatar Jan 29 '24 13:01 kieranhall