Google open sources JavaScript testing tools

Google is open sourcing one of its key JavaScript testing tools in an effort to get developers to speed up web applications.

Google JS Test is used internally on the V8 JavaScript engine using in Chrome. Google has attributed much of the speed increases it claims for the browser to the performance of the V8 engine, and the company is clearly hoping this will improve matters further.

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.” ®