Why we need test
Please see this article
Test Goals
- The test suite should be fast, to encourage us to write more tests and save us time;
- We should be able to test our React components effectively;
- The test suite should play well with ES6 syntax and our webpack setup;
- The test suite must be integrated alongside our current integration tests on CircleCI
Why not Jest
- Slow
Test suite of about 60 test cases 10 seconds vs 200ms (Karma) - I don’t like the module mocking that makes things look like black boxes
- I never actually wanted/needed black boxing
- The documentation was lacking
- I had to come up with a hacky way to call it from Node
- I didn’t really know how to debug my tests other than by the really long stack traces
- it didn’t run in a real browser.
How do test
Test points
- End to End test
- Dumb React components
- Smart React components
- Redux Store (action/reducers)
3rd libraries
- Karama
- Mocha
- Sinon
- Chai
- JSDOM
Issues
issue: framework “sinon” is not defined
fix: npm install -g karma-cli
Github issue