Testing

How to test your app locally

How to launch tests locally, with coverage

JavaScript

yarn test

Ruby (unit tests) and Cypress (e2e tests)

bin/rails db:drop db:create db:migrate RAILS_ENV=test
rm -rf coverage
FUNCTIONAL_COVERAGE_PLEASE=true bin/rails cypress:run 
UNIT_COVERAGE_PLEASE=true bin/rails test
bin/rails coverage:report

The last line will merge unit & e2e reports. All coverage reports are then available in the coverage/ folder

How to launch tests locally, without coverage

JavaScript - no difference, just launch yarn test, coverage is still set up, but will not slow down the test suite.

Rails unit tests

bin/rails test

e2e test, with visual editor

bin/rails cypress:open

e2e test, headless run, without editor (like on the CI)

bin/rails cypress:run