Comparing version 0.0.1 to 0.0.2
@@ -0,11 +1,9 @@ | ||
#!/usr/bin/env node | ||
// Generated by CoffeeScript 1.4.0 | ||
(function() { | ||
var Mycha, mycha; | ||
var Mycha, mycha; | ||
Mycha = require(__dirname + '/mycha'); | ||
Mycha = require(__dirname + '/mycha'); | ||
mycha = new Mycha(process.cwd()); | ||
mycha = new Mycha(process.cwd()); | ||
mycha.run(); | ||
}).call(this); | ||
mycha.run(); |
109
mycha.js
// Generated by CoffeeScript 1.4.0 | ||
(function() { | ||
var Mocha, Mycha, child, fs, path; | ||
var Mocha, Mycha, child, fs, path; | ||
Mocha = require('mocha'); | ||
Mocha = require('mocha'); | ||
fs = require('fs'); | ||
fs = require('fs'); | ||
path = require('path'); | ||
path = require('path'); | ||
child = require('child_process'); | ||
child = require('child_process'); | ||
Mycha = (function() { | ||
Mycha = (function() { | ||
function Mycha(projectDir, options) { | ||
if (options == null) { | ||
options = {}; | ||
} | ||
this.stdout = options.stdout || process.stdout; | ||
this.stderr = options.stdin || process.stderr; | ||
this.reporter = options.reporter || 'dot'; | ||
this.testDir = path.join(projectDir, 'test'); | ||
function Mycha(projectDir, options) { | ||
if (options == null) { | ||
options = {}; | ||
} | ||
this.stdout = options.stdout || process.stdout; | ||
this.stderr = options.stdin || process.stderr; | ||
this.reporter = options.reporter || 'dot'; | ||
this.testDir = path.join(projectDir, 'test'); | ||
} | ||
Mycha.prototype.getTestFiles = function() { | ||
var files, helper; | ||
files = []; | ||
helper = function(dir, files) { | ||
var file, filePath, stat, _i, _len, _ref, _results; | ||
_ref = fs.readdirSync(dir); | ||
_results = []; | ||
for (_i = 0, _len = _ref.length; _i < _len; _i++) { | ||
file = _ref[_i]; | ||
if (file[0] === '.') { | ||
continue; | ||
} | ||
filePath = path.resolve("" + dir + "/" + file); | ||
stat = fs.statSync(filePath); | ||
if (stat.isFile()) { | ||
_results.push(files.push(filePath)); | ||
} else if (stat.isDirectory()) { | ||
_results.push(helper(filePath, files)); | ||
} else { | ||
_results.push(void 0); | ||
} | ||
Mycha.prototype.getTestFiles = function() { | ||
var files, helper; | ||
files = []; | ||
helper = function(dir, files) { | ||
var file, filePath, stat, _i, _len, _ref, _results; | ||
_ref = fs.readdirSync(dir); | ||
_results = []; | ||
for (_i = 0, _len = _ref.length; _i < _len; _i++) { | ||
file = _ref[_i]; | ||
if (file[0] === '.') { | ||
continue; | ||
} | ||
return _results; | ||
}; | ||
helper.call(helper, this.testDir, files); | ||
return files; | ||
}; | ||
Mycha.prototype.run = function(callback) { | ||
var args, childProcess; | ||
if (callback == null) { | ||
callback = (function() {}); | ||
filePath = path.resolve("" + dir + "/" + file); | ||
stat = fs.statSync(filePath); | ||
if (stat.isFile()) { | ||
_results.push(files.push(filePath)); | ||
} else if (stat.isDirectory()) { | ||
_results.push(helper(filePath, files)); | ||
} else { | ||
_results.push(void 0); | ||
} | ||
} | ||
args = [['--compilers', 'coffee:coffee-script'], ['--reporter', this.reporter], '--colors', "" + __dirname + "/helper.coffee", this.getTestFiles()]; | ||
args = [].concat.apply([], args); | ||
childProcess = child.spawn("" + __dirname + "/node_modules/mocha/bin/mocha", args); | ||
childProcess.stdout.pipe(this.stdout); | ||
childProcess.stderr.pipe(this.stderr); | ||
return childProcess.on('exit', callback); | ||
return _results; | ||
}; | ||
helper.call(helper, this.testDir, files); | ||
return files; | ||
}; | ||
return Mycha; | ||
Mycha.prototype.run = function(callback) { | ||
var args, childProcess; | ||
if (callback == null) { | ||
callback = (function() {}); | ||
} | ||
args = [['--compilers', 'coffee:coffee-script'], ['--reporter', this.reporter], '--colors', "" + __dirname + "/helper.coffee", this.getTestFiles()]; | ||
args = [].concat.apply([], args); | ||
childProcess = child.spawn("" + __dirname + "/node_modules/mocha/bin/mocha", args); | ||
childProcess.stdout.pipe(this.stdout); | ||
childProcess.stderr.pipe(this.stderr); | ||
return childProcess.on('exit', callback); | ||
}; | ||
})(); | ||
return Mycha; | ||
module.exports = Mycha; | ||
})(); | ||
}).call(this); | ||
module.exports = Mycha; |
{ | ||
"name": "mycha", | ||
"version": "0.0.1", | ||
"version": "0.0.2", | ||
"main": "mycha.js", | ||
@@ -5,0 +5,0 @@ "bin": { |
10
4377
64