There is an official Cordoba library for running unit tests.
From the Root template for testing plugins on github:
The org.apache.cordova.test-framework plugin has two functions:
- Defines an interface for cordova plugins for writing tests
- Provides test posting to actually run these tests.
Tests are performed directly within existing cordova projects, so you can quickly switch between testing and development. You can also be sure that your test suite is testing the exact versions of the plugins and platforms for which your application is using.
Visit this page; there is a lot of information on running existing tests and using the framework for your own plugins.
source share