Getting Started on Testing with Typescript, ReactJS, and Webpack

Willson Mock
8 min readMar 31, 2016

Recently, I wrote a tutorial on how to get started using Typescript, ReactJS, and Webpack because I noticed there weren’t many good online resources highlighting how to integrate them together. In this post, I want to continue where I left off and add a wrinkle many people have asked for: Testing. I won’t explain why we want to write tests for our code because if you’re reading this, I’m going to assume you know how important and life-saving it can be! Instead, my goal with this post is to provide a structure for writing tests in a project that uses Typescript, ReactJS, and Webpack, and explain why we use some of these testing technologies.

For those of you who want to dive in and see the final version of the code, check it out here!

Brief prelude on the different Testing technologies

As we all know, the JavaScript community has tons of different libraries and frameworks for doing just about anything you can imagine. As you can guess, the same is true for testing JavaScript code and there’s a myriad of technologies out there. At a high level though, these technologies fall into 4 major categories:

  1. Test Runner (example: KarmaJS)
  2. Testing Framework (example: MochaJS)

--

--

Willson Mock

I’m an avid learner, and I write about web technologies, personal fitness, and other fun stuff. http://willsonmock.com