I recently rebuilt a moderately sized jQuery application/component using Lit, with the end result being 6-7 components spread over around 2,000 lines of code.

We currently have no automated testing at all but I'd like to implement it, especially now as the markup/styles have been moved into JavaScript. It's much better overall - but it feels riskier.

But I have no idea where to even begin. Do I set up end to end tests using Playwright on site? Can I test the components individually? Keeping in mind as well that we don't use a build system/any sort of CI.

Just wanted to get people's thoughts/experiences here.

all 3 comments

sorted by: hot top controversial new old
[–] 0 points 3 years ago

I'd go ahead with cypress, both for e2e testing (whole app at once, component integration etc) and component testing (testing components in isolation)

  • source
  • [–] 0 points 3 years ago (1 child)

    Check out storybook -> https://storybook.js.org/

    People generally think of storybook as a place where you can view components in different configurations but you can reuse the “stories” for testing (in a kind of write once test everywhere kind of way)

  • source
  • hideshow 1 child comment