AgnosticUI / agnosticui

AgnosticUI is a set of UI primitives that start their lives in clean HTML and CSS. These standards compliant components are then copied to our framework implementations in: React, Vue 3, Angular, and Svelte.
https://agnosticui.com
Apache License 2.0
723 stars 47 forks source link

Test Coverage #216

Open roblevintennis opened 2 years ago

roblevintennis commented 2 years ago

Epic — Test Coverage

We will likely break this up into framework specific issues like "Vue Test Coverage", "React Test Coverage", etc. For now, I just wanted to capture the overall notion that we'd like to increase test coverage…


There's a whole back story on why, but we don't have great test coverage across AgnosticUI. At one point we were starting to in some of the packages, but, then we did big upgrades from Svelte to SvelteKit, Vue 2 to Vue 3, etc., etc.

I do find that certain tests can do more harm than good e.g. when a unit test delves deep into the implementation details of the system under test, or, really complex setups or spies. This can cause a huge burden in making bug fixes, refactoring, etc., if it's extremely hard to understand the setup.

I've had success using Cypress to do "just enough" testing. This is an example of a very simple Cypress script I used when doing the port of vue-a11y-dialog to Vue 3: https://github.com/morkro/vue-a11y-dialog/blob/main/src/Demo.spec.ct.js

As can be seen, the tests are quite simple yet supply a pretty decent amount of coverage. I would like us to take a similar approach and start to add test coverage across the Svelte, Vue 3, and React implementations.