How are you testing React Onsen Apps?

  • What is the recommended way to test Onsen React apps? Or even just Onsen apps, in general. I am hoping to use something like Enzyme, which, unfortunately, does not work (see thread below) and nor does the proposed workaround. I also don’t want to maintain patch logic just to get some unit tests to run. But, ideally, I wanted something that can run quickly and isn’t too heavyweight.

    Can anyone recommend something?

  • Onsen UI

    @mpkelly Hi! There is a small section about this in the guide. Same goes for Enzyme. Onsen UI relies on Custom Elements v1 so it needs a testing suite that supports it.

    Everything that relies on jsDOM, unfortunately, won’t work. Anything with Chrome Headless or Selenium should be fine since it’s what we use to do unit tests and e2e tests.

    There’s also some DOM implementations like undom that supports Custom Elements if I’m not mistaken. Perhaps it could be used with Jest, for example.

Log in to reply