Files
open-wc/docs/guides/developing-components/testing.md
Thomas Allmer 0a1b247513 chore: new website using rocket
Co-authored-by: Lars den Bakker <larsdenbakker@gmail.com>
2020-10-29 11:50:15 +01:00

949 B

Developing Components >> Testing ||30

If you choose the testing option in the project generator it will scaffold some example tests for your component.

Web Test Runner

We recommend @web/test-runner for testing web components. It's based on @web/dev-server, following the same approach using native es modules, and runs tests in a real browser.

Running the tests

To run the tests, execute this command:

npm run test

This will run the tests in a locally installed Chrome browser. There are many other browser options in Web Test Runner as well.

To run the tests in watch mode, execute this command:

npm run test:watch

This will keep the test runner open. Editing files will re-run the associated tests.

Step by step guide

Follow this guide for a full step by step guide on using Web Test Runner