Code coverage report for spec/env/runner.js

Statements: 100% (25 / 25)      Branches: 50% (1 / 2)      Functions: 100% (8 / 8)      Lines: 100% (25 / 25)      Ignored: none     

All files » spec/env/ » runner.js
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 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 461       1       1   1 26 20   1   1 1 1 1           1 3 3 3 3 3 3     3 60     3 3 3 3 3      
var fs = require('fs'),
    Mocha = require('mocha'),
    path = require('path');
 
var errors = 0,
    testDir = path.dirname(__dirname),
    grep = process.argv[2];
 
var files = [ testDir + "/basic.js" ];
 
var files = fs.readdirSync(testDir)
      .filter(function(name) { return (/.*\.js$/).test(name); })
      .map(function(name) { return testDir + '/' + name; });
 
console.log(files);
 
run('./node', function() {
  run('./browser', function() {
    run('./runtime', function() {
      process.exit(errors);
    });
  });
});
 
 
function run(env, callback) {
  var mocha = new Mocha();
  mocha.ui('bdd');
  mocha.reporter('spec');
  mocha.files = files.slice();
  Eif (grep) {
    mocha.grep(grep);
  }
 
  files.forEach(function(name) {
    delete require.cache[name];
  });
 
  console.log('Running env: ' + env);
  require(env);
  mocha.run(function(errorCount) {
    errors += errorCount;
    callback();
  });
}