The /tests
directory contains HASH tests which for one reason or another aren't inlined with the code they correspond to (e.g. unit tests). This includes integration tests, load tests, and performance benchmarks. In the future, end-to-end tests will also be stored here.
This README
additionally includes helpful information about testing in HASH.
While using HASH as an end-user, various parts of the user interface -- specifically designed to help with development and debugging -- are hidden. As a developer, you can display these elements by running the following in your browser console:
localStorage["hash.internal.debugging"] = "true";
Backend integration tests are located in the /tests/hash-backend-integration
folder.
The tests require a running instance of hash-external-services
. see the root README for information on doing this without polluting the development database.
yarn test:backend-integration
We originally planned to use Playwright API testing feature instead of Jest (subsequently replaced by Vitest), which would have led to the convergence of yarn test:backend-integration
and yarn test:playwright
-- this may still happen.
Playwright tests are browser-based integration and end-to-end tests.
The playwright tests are located within the /tests/hash-playwright/tests
folder.
To run these tests locally, you will need to have both backend and frontend running.
- The tests require a running instance of
external-services
. see the root README for information on doing this without polluting the development database.
yarn dev:backend
yarn seed-data
## option 1: frontend in dev mode
yarn dev:frontend
## option 2: frontend in prod mode
yarn workspace @apps/hash-frontend build
yarn workspace @apps/hash-frontend start
yarn test:playwright
You can add extra arguments to configure how Playwright runs, e.g.:
yarn test:playwright --headed
See yarn test:playwright --help
for more info.
Unit tests are executed by Vitest, which we use in place of Jest, due to its improved TS/ESM compatibility. Unit tests are typically colocated alongside the code they cover.
Unit tests can be launched at any time with this command:
yarn test:unit
Note: some of the unit tests may output console.error messages. Please disregard these and focus on the pass/fail indicators.