https://github.com/mishoo/UglifyJS
Raw File
Tip revision: 2dde41615a22ec16b52028a5b09a42b50e4ee094 authored by Alex Lam S.L on 02 July 2017, 09:24:22 UTC
v3.0.23
Tip revision: 2dde416
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);
            });
        }
    });
};
back to top