Home / Companies / Rescale / Blog / Post Details
Content Deep Dive

Testing React and Flux Applications with Karma and Webpack

Blog post from Rescale

Post Details
Company
Date Published
Author
Rescale Engineering
Word Count
1,145
Language
English
Hacker News Points
-
Summary

Rescale transitioned from using Facebook's Jest framework to a combination of Karma, Webpack, and Jasmine for testing their React and Flux application due to performance issues, as Jest was found to be slow with a non-trivial test suite. By employing the new setup, they achieved a significant speed improvement, reducing the test execution time from over 10 seconds to under 200 milliseconds using PhantomJS after initial Webpack bundling. The new testing framework uses karma-webpack for bundling tests into a single file, and the setup includes methods for isolating module states between tests, which is crucial for testing Flux Stores and their singleton nature. While the new system requires more setup and knowledge, it provides the necessary speed and flexibility for testing, despite being less straightforward than Jest's automatic mocking capabilities. This switch allowed Rescale to maintain efficient test-driven development (TDD) practices, despite the additional complexity.