Skip to content

Commit

Permalink
[refactor v0.6] Remove/replace sys usages
Browse files Browse the repository at this point in the history
  • Loading branch information
mmalecki committed Oct 11, 2011
1 parent 485698d commit eac4362
Show file tree
Hide file tree
Showing 6 changed files with 19 additions and 21 deletions.
6 changes: 3 additions & 3 deletions lib/vows.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
// }
// }).run();
//
var sys = require('sys'),
var util = require('util'),
path = require('path'),
events = require('events'),
vows = exports;
Expand Down Expand Up @@ -141,7 +141,7 @@ process.on('exit', function () {
}
});

if (unFired.length > 0) { sys.print('\n') }
if (unFired.length > 0) { util.print('\n') }

unFired.forEach(function (title) {
s.reporter.report(['error', {
Expand All @@ -161,7 +161,7 @@ process.on('exit', function () {
});
});
if (failure) {
sys.puts(console.result(results));
util.puts(console.result(results));
}
});

Expand Down
6 changes: 3 additions & 3 deletions lib/vows/coverage/report-html.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
var sys = require('sys'),
var util = require('util'),
fs = require('fs'),
file = require('./file');

Expand All @@ -21,7 +21,7 @@ this.report = function (coverageMap) {
head = fs.readFileSync(__dirname + "/fragments/coverage-head.html", "utf8");
foot = fs.readFileSync(__dirname + "/fragments/coverage-foot.html", "utf8");
} catch (error) {
sys.print("Error: Unable to write to file coverage.html\n");
util.print("Error: Unable to write to file coverage.html\n");
return;
}

Expand Down Expand Up @@ -51,4 +51,4 @@ this.report = function (coverageMap) {

fs.writeSync(out, foot);
fs.close(out);
};
};
6 changes: 3 additions & 3 deletions lib/vows/coverage/report-json.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
var sys = require('sys'),
var util = require('util'),
fs = require('fs'),
file = require('./file');

Expand Down Expand Up @@ -48,7 +48,7 @@ this.report = function (coverageMap) {
fs.writeSync(out, JSON.stringify(output));
fs.close(out);
} catch (error) {
sys.print("Error: Unable to write to file coverage.json\n");
util.print("Error: Unable to write to file coverage.json\n");
return;
}
};
};
14 changes: 7 additions & 7 deletions lib/vows/coverage/report-plain.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
var sys = require('sys'),
var util = require('util'),
file = require('./file');

this.name = 'coverage-report-plain';
Expand All @@ -24,15 +24,15 @@ this.report = function (coverageMap) {
if (coverageMap.hasOwnProperty(filename)) {
var data = file.coverage(filename, coverageMap[filename]);

sys.print(filename + ":\n");
sys.print("[ hits: " + data.hits + ", misses: " + data.misses);
sys.print(", sloc: " + data.sloc + ", coverage: " + data.coverage.toFixed(2) + "% ]\n");
util.print(filename + ":\n");
util.print("[ hits: " + data.hits + ", misses: " + data.misses);
util.print(", sloc: " + data.sloc + ", coverage: " + data.coverage.toFixed(2) + "% ]\n");

for (var i = 0; i < data.source.length; i++) {
sys.print(lpad(data.source[i].coverage, 5) + " | " + data.source[i].line + "\n");
util.print(lpad(data.source[i].coverage, 5) + " | " + data.source[i].line + "\n");
}

sys.print("\n");
util.print("\n");
}
}
};
};
6 changes: 3 additions & 3 deletions lib/vows/reporters/spec.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
var sys = require('sys');
var util = require('util');

var options = { tail: '\n' };
var console = require('../../vows/console');
Expand Down Expand Up @@ -28,7 +28,7 @@ this.report = function (data) {
puts(console.vowText(event));
break;
case 'end':
sys.print('\n');
util.print('\n');
break;
case 'finish':
puts(console.result(event).join('\n'));
Expand All @@ -40,5 +40,5 @@ this.report = function (data) {
};

this.print = function (str) {
sys.print(str);
util.print(str);
};
2 changes: 0 additions & 2 deletions lib/vows/reporters/watch.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
var sys = require('sys');

var options = {};
var console = require('../../vows/console');
var spec = require('../../vows/reporters/spec');
Expand Down

0 comments on commit eac4362

Please sign in to comment.