You can clone with HTTPS or Subversion.
Clone in Desktop Download ZIPNow node-webkit's testing works have to parts: automatic tests and manual test. Node-webkit uses Mocha to run automatice tests.
How to run node-webkit's test cases
In folder automatic_test, every subdirectory has a file called mocha_test.js. In mocha_test.js, there are test cases writed using mocha. Finally we load these test case and run them in index.html.
Mocha is easy to use, you can directly wirte mocha code in mocha_test.js. But if you have a simple app and want to ues it, there are some traps.
Since you need to spawn a new process for the app, but there would be problem using the communication method of node.js's child_process modoule. So you need to use other method for the data transporting like using socket.
In node-webkit testing system, we have implement a simple module nw_test_app for the job. How to use it:
mocha_test.js:
var child = app_test.createChildProcess({
execPath: process.execPath,
appPath: 'path_to_app',
end: function(data, app) {
if (data.ok) {
done();
} else {
done('error');
}
}
});app:
var client = require('nw_test_app').createClient({
argv: gui.App.argv,
data: {ok : true},
});