1 var exec = require('child_process').exec;
3 var helpers = new (function () {
8 var _runner = function () {
9 if ((_name = _names.shift())) {
10 console.log('Running ' + _name);
18 this.exec = function () {
19 var args = Array.prototype.slice.call(arguments);
21 var cmd = args.shift();
24 // Optional opts/callback or callback/opts
25 while ((arg = args.shift())) {
26 if (typeof arg == 'function') {
35 var execOpts = opts.execOpts ? opts.execOpts : {};
36 exec(cmd, execOpts, function (err, stdout, stderr) {
37 var out = helpers.trim(stdout);
39 if (opts.breakOnError === false) {
55 this.trim = function (s) {
57 return str.replace(/^\s*|\s*$/g, '');
60 this.parse = function (s) {
62 str = helpers.trim(str);
63 str = str.replace(/'/g, '"');
64 return JSON.parse(str);
67 this.run = function (tests, callback) {
69 _names = Object.keys(tests);
74 this.next = function () {
80 module.exports = helpers;