Search code examples
testingreactjsjspm

React JSPM testing framework


What is the best testing framework and its associated helper libraries to use for a project in React and JSPM? I'm looking for various libraries combined together and what is specific to that set which makes it a powerful toolset? (Looking to incorporate redux later on)


Solution

  • I recently build testing environment for a react application using JSPM.

    I first wanted to use Jest, as it is recommended by the community with react. But then I found out that thread, saying support for JSPM/SystemJs wasn't on the roadmap at the moment.

    Although it exists some work to make it work, see for example: https://www.npmjs.com/package/systemjs-jest


    Then I chose to use Jasmine as it is quite known in my company, and I already worked with it. Also I think Jest used to be based on Jasmine, so many react-specific matchers developed for Jest are also compatible with Jasmine.


    So I ended up using Jasmine with Karma, using karma-jasmine and karma-uiuxengineering-jspm.

    Make sure to read the documentation of karma-uiuxengineering-jspm thoroughly, it took me some time to set the environment up.

    Some nice additions:
    - jasmine-enzyme (installed with JSPM)
    - karma-mocha-reporter (installed with npm)
    - karma-phantomjs-launcher (installed with npm)