Version0 /
testing ModuleThis 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. Functions
In the future, it would also be helpful to have:
Events
UsageFirst, 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 var self = this; this.addInputHandler('testFile', function () { var fileName = self.get('testFile'); if (fileName !== null && fileName !== "") { testing.loadTestFile(fileName); testing.run(); } }); Register a listener for the 'end' event to receive the results. For example, to send the results to an output named 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 |