We're incrementally moving unit tests out of Meteor+Mocha and into pure Jest tests. Jest test files end in
.test.js and can be anywhere in the Reaction codebase, ideally in the same folder and with the same base filename as the code being tested.
Jest tests are used for all of the GraphQL code.
watchman if you are on Mac OSX and you'd like to run
--watchAll on tests (such as the
npm run test:unit:watch command).
brew install watchman
To run tests:
npm run test:unit
Run tests in watch mode
To run tests and rerun as you make changes to test files:
npm run test:unit:watch
Run tests within a Docker container
You can use Docker Compose to run a local development container and run tests within it. This gives a more accurate picture of how production code running in a container will behave.
docker-compose run --rm devserver npm run test:unit
(This will also work with
:watch suffix for watch mode.)