Revision 852f78491a212ba20841847436dab93abb0a8181 authored by Ondřej Španěl on 24 February 2017, 00:51:24 UTC, committed by Alex Lam S.L on 24 February 2017, 00:51:24 UTC
Makes direct usage within web browser easier, even if officially unsupported.
1 parent 229e42c
mocha.js
var Mocha = require('mocha'),
fs = require('fs'),
path = require('path');
// Instantiate a Mocha instance.
var mocha = new Mocha({});
var testDir = __dirname + '/mocha/';
// Add each .js file to the mocha instance
fs.readdirSync(testDir).filter(function(file){
// Only keep the .js files
return file.substr(-3) === '.js';
}).forEach(function(file){
mocha.addFile(
path.join(testDir, file)
);
});
module.exports = function() {
mocha.run(function(failures) {
if (failures !== 0) {
process.on('exit', function () {
process.exit(failures);
});
}
});
};
![swh spinner](/static/img/swh-spinner.gif)
Computing file changes ...