# Javascript Unit Testing

**URL:** <https://forum.djangoproject.com/t/javascript-unit-testing/8469>\
**Category:** Using Django\
**Created:** [June 22, 2021, 2:41pm UTC](https://forum.djangoproject.com/t/javascript-unit-testing/8469 "2021-06-22T14:41:23Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![artoonie](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.djangoproject.com/artoonie/32/4930_2.png) [@artoonie](https://forum.djangoproject.com/u/artoonie)\
**Post date:** [June 22, 2021, 2:41pm UTC](https://forum.djangoproject.com/t/javascript-unit-testing/8469/1 "2021-06-22T14:41:23Z")

</div>

What is your favorite way of unit testing Javascript in your Django project?

**Problem**  
Django makes it relatively easy to build integration tests with Selenium and a headless browser. This works great when a project is small, but is cumbersome. Both in syntax and performance, using selenium is not a great solution for Javascript unit tests.

**My Not-So-Great Solution**  
What I’ve begun doing is separating out javascript modules into separate repositories that are tested with standard node tools (jest, etc). It gives me all the benefits of a Javascript test framework (speed, easy mocking, etc). I install these modules with [django-node-assets](https://pypi.org/project/django-node-assets/).

This works nicely for some components that are easily separable, but ends up being a pain in many cases.

**Discussion/Question**  
What are your thoughts on Javascript unit testing for a Django project with hundreds of integration tests and the potential for thousands of Javascript unit tests?
