This project uses Jest for unit and snapshot testing.
You can run all the tests by
npm test
All test cases can be found under the test
folder.
If you are working on a feature using TDD, you can run and watch a particular test by
npm test ./test/stdlib.math.test.ts -- --watch
We use Snapshot Testing for examples
to make sure most of the code works as expected.
There are some articles about snapshot testing:
- https://jest-bot.github.io/jest/docs/snapshot-testing.html
- https://scotch.io/tutorials/writing-snapshot-tests-for-react-components-with-jest
If you made some changes by purpose and it breaks the snapshot testing, you may need to update the snapshot by
npm run test:update