Javascript unit test framework


Is it possible to use such unit test frameworks like QUnit, Jasmine or JsUnit? Or, do you need a special unit test framework for the Hifi interface?



HiFi exposes a proprietary API to scripting, but ultimately the scripts are just JavaScript – so it’s definitely possible to unit test them using typical frameworks.

What I currently use is Mocha + Chai. For simulating the proprietary APIs there is Sinon.JS – which lets you create on-demand spies, mocks, etc. (as part of your testing setup/tear-down logic). It also supports time-bending which makes it easier to instrument scenarios with timeouts and other signals.

Technically you can get these libraries to function within Interface too – which sorta defeats the point of unit testing, but would work for certain integration, regression and characterization tests.


Thank you for your advice. I will try out the called unit test frameworks.