Outcomes uses Jest and React Testing Library for our test suite. We have __tests__ directories
located at any level of the filesystem where tests can be created using the following convention:
logic: src/components/example.js
tests: src/components/__tests__/example.test.js
To run the test suite:
yarn test
To set up the development environment with Docker:
docker-compose run --rm ui yarn --ignore-scripts
To run tests in Docker:
docker-compose run --rm ui yarn test
Open ui.outcomes.docker in your browser for the development server.
Run yarn run lint to lint the src dir, or use Docker:
docker-compose run --rm ui yarn run lint
We are using ESLint.
As a convenience, you can install a pre-push hook for git to prevent pushing eslint failing code to gerrit.
cp hooks/pre-push.example .git/hooks/pre-pushCode coverage is automatically generated when running the test suite with yarn test.
After running tests, you can inspect the generated HTML report:
open coverage/index.html