Skip to content

Frontend Testing

Unit tests

We use Vitest: a fast, modern Jest alternative. Please put Vitest files next to the JS file you test, with the same name and the .test.js extension. Example:

text
├─ ./resources/js/components/
   ├─ tocContainer.js
   └─ tocContainer.test.js

Running unit tests

sh
npm run test:unit

CI/CD integration

JS unit tests are integrated to CI/CD pipeline as a blocking step.

End-to-end tests

We use Cypress for end-to-end tests, but do not have any tests at this moment (late 2024). Tests directory: tests/js.

Cypress is a tool of our choice (e.g., over Laravel Dusk) because it does not limit front-end developers to PHP.

Running end-to-end tests

sh
npm run test:browser
sh
npm run cypress

Visual regression tests

Not implemented yet (but will be nice to have).