# Unit tests for user code

**URL:** https://discourse.vtk.org/t/unit-tests-for-user-code/4391
**Category:** Web
**Created:** [October 9, 2020, 11:42pm UTC](https://discourse.vtk.org/t/unit-tests-for-user-code/4391 "2020-10-09T23:42:41Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![seattlewayne](https://discourse.vtk.org/user_avatar/discourse.vtk.org/seattlewayne/32/3958_2.png) [@seattlewayne](https://discourse.vtk.org/u/seattlewayne)
#### Post date: [October 9, 2020, 11:42pm UTC](https://discourse.vtk.org/t/unit-tests-for-user-code/4391/1 "2020-10-09T23:42:41Z")

</div>

I have built a webapp that utilizes VTK.js. I have not been able to get unit test coverage for my classes that reference VTK.js code. Karma (which is used in VTK.js) is built for CommonJs modules. It has tools for using ES modules, but they don’t seem to work together with the VTK.js libraries and Typescript.

Have any folks found unit test tools that work for Typescript code that utilizes VTK.js?

BTW, I noticed that [ParaView Glance](https://github.com/kitware/paraview-glance) does not include any unit tests at all. Perhaps this problem is harder to solve than I hope.

---

<div class="post-metadata">

### Author: ![Forrest](https://discourse.vtk.org/user_avatar/discourse.vtk.org/forrest/32/300_2.png) [@Forrest](https://discourse.vtk.org/u/Forrest)
#### Post date: [October 14, 2020, 7:36pm UTC](https://discourse.vtk.org/t/unit-tests-for-user-code/4391/2 "2020-10-14T19:36:03Z")

</div>

Are you transpiling your TS code and then testing? Transpiling (especially with a bundler like webpack) should remove the need for dealing with modules when testing. Though it does introduce a transpile/bundle step into your unit testing workflow.
