Testing
In order to ensure that your Stencil components work in the way you expect, Stencil supports a number of tools enabling unit, spec, component and end-to-end testing.
Library Support
Stencil supports the following for testing components:
- @stencil/vitest: First-class testing utilities for Stencil components powered by Vitest. Tests run in real browsers, with screenshot capabilities, or in Node with your choice of DOM (jsdom, happy-dom, mock-doc). This is the recommended testing solution for most Stencil projects.
- @stencil/playwright: An automated end-to-end testing framework that can run across all major browsers. Use this for full application testing, routing tests, and scenarios requiring proper browser initialization.
Coming from Stencil v4's integrated test runner (--spec/--e2e, Jest and Puppeteer)? That runner is removed in v5. See the vitest migration guide, which also covers keeping your newSpecPage() tests.