packages/lexical-website/docs/testing.md
Lexical relies on tests to ensure that changes don't break anything, using a mix of unit and end-to-end tests.
We use vitest to run unit tests in core (lexical package). The goal is to have a well tested API, enabling us to add or modify features without breaking it.
To run the tests use:
npm run test-unit
Unit tests can be found in this directory.
We use Playwright for running E2E tests in Chromium, Firefox and WebKit. Before running these tests, make sure to install the necessary browsers using the following command:
npx playwright install
These tests run in the lexical-playground package and are divided into proactive and reactive tests (e2e and regression directories).
The goal for this type of test is to validate the behavior of Lexical in a browser, without necessarily knowing how the internals work.
To run E2E tests use:
npm run start &
npm run test-e2e-chromium # or -firefox, -webkit
E2E tests can be found in this directory
When writing tests, please follow these practices: