Recent Changes - Search:

edit SideBar

testing Module

This module provides a uniform interface for testing services, including mocha for test development, the chai assertion library, and sinon for test spies, stubs and mocks.

The Test accessor uses this module to read and execute mocha test files.

Regression testing instructions are available.

See also Testing.


  • Testing(): Create a new Testing object.
  • loadTestFile(filename): Load the given test file.
  • run(): Execute the test file.

In the future, it would also be helpful to have:

  • clearTests(): Clear all currently loaded tests.
  • loadTests(string): Load the tests in the given string.
  • setReporter(enum): Set the format of the output to one of the reporter choices.


  • end: Emitted when all tests have completed. Supplies the test results.


First, require the module and create a new testing object.

   var Testing = require('testing');
   var testing = new Testing.Testing();

Then, load a test file and invoke run. For example, to run a test file supplied by an input named testFile:

   var self = this;  
   this.addInputHandler('testFile', function () {
        var fileName = self.get('testFile');
        if (fileName !== null && fileName !== "") {

Register a listener for the 'end' event to receive the results. For example, to send the results to an output named output:

    var self = this;    // If not set already, e.g. as above.
    testing.on('end', function(result) {
    	self.send('output', result);

Back to Optional JavaScript Modules

Edit - History - Print - Recent Changes - Search
Page last modified on April 17, 2017, at 07:50 AM