Integrating Jest with JSPM based app

73 Views Asked by At

So I wanted to use Jest with my jspm project to write some unit tests, but it turned out it's not so easy... Well, it even turned out it's not so easy with any other testing framework.

How do I write tests for my jspm app? Which framework should I choose? Everything that I look up is quite complicated. I haven't found an easy solution. Every framework seems to require a bunch of workarounds to get things working in jspm setup. I feel kind of lost at the moment

If not Jest, then what would be the least painful way of testing an app in jspm setup?

1

There are 1 best solutions below

0
On

its true that without a 3rd party utility its not really possible to test a jspm based app with Jest. luckily, there's such a tool to help you do that: https://www.npmjs.com/package/gulp-jest-jspm (mine coincidentally)

You will need to install and use Gulp in order to run your tests

Ive been testing my own React app (built with JSPM) with Jest and its very straightforward.

I've found Jest to be very easy to learn and use. Let me know if you need more info

Yoav