The code includes a testing function with the ability to create mock functions or class instances that can be used to check code’s operating parameters within the unit testing framework. Test runs on functions can then be carried out using the gjstest tool. Testing can be done outside the browser, but only without touching the Document Object Model (DOM).
“A requirement for using Google JS Test for a test is that the test and the code it executes be composed of pure JS,” the company said in its release notes. “That's not to say that you can't test code that manipulates the DOM – you can still do so by passing in mock implementations of DOM manipulation functions in your tests.” ®