https://github.com/mishoo/UglifyJS
Raw File
Tip revision: 3c2b3aeddb58848b076aacc05acc026b258e0110 authored by Alex Lam S.L on 05 March 2017, 15:03:30 UTC
Merge pull request #1554 from alexlamsl/harmony-v2.8.6
Tip revision: 3c2b3ae
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