File: mocha.js

package info (click to toggle)
uglifyjs 2.7.5-2%2Bdeb9u1
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 1,316 kB
  • sloc: makefile: 46
file content (29 lines) | stat: -rw-r--r-- 661 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
var Mocha = require('mocha'),
    fs = require('fs'),
    path = require('path');

// Instantiate a Mocha instance.
var mocha = new Mocha({ timeout: 0 });

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);
            });
        }
    });
};