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

  1. Slow
    Test suite of about 60 test cases 10 seconds vs 200ms (Karma)
  2. I don’t like the module mocking that makes things look like black boxes
  3. I never actually wanted/needed black boxing
  4. The documentation was lacking
  5. I had to come up with a hacky way to call it from Node
  6. I didn’t really know how to debug my tests other than by the really long stack traces
  7. 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

Sites choosing FE Test techniques

testing-with-reactjs-at-codecademy