beginning of trivial node reporter, based on jasmine-node. jshint rules exclude bad escapements WRT ansi colors, beacuse that's ok.
This commit is contained in:
70
spec/suites/TrivialNodeReporterSpec.js
Normal file
70
spec/suites/TrivialNodeReporterSpec.js
Normal file
@@ -0,0 +1,70 @@
|
||||
describe("TrivialNodeReporter", function() {
|
||||
|
||||
|
||||
var green = function(str) {
|
||||
return '\033[32m' + str + '\033[0m'; //keep these literal. otherwise the test loses value as a test.
|
||||
};
|
||||
|
||||
var red = function(str) {
|
||||
return '\033[31m' + str + '\033[0m';
|
||||
};
|
||||
|
||||
var newline = "\n";
|
||||
|
||||
beforeEach(function() {
|
||||
this.fakeSys = (function(){
|
||||
var output = "";
|
||||
return {
|
||||
puts:function(str) {output += str + "\n";},
|
||||
print:function(str) {output += str;},
|
||||
getOutput:function(){return output;}
|
||||
};
|
||||
})();
|
||||
|
||||
this.env = new jasmine.Env();
|
||||
this.env.updateInterval = 0;
|
||||
|
||||
this.reporter = new jasmine.TrivialNodeReporter(this.fakeSys);
|
||||
});
|
||||
|
||||
// reportSpecResults: function(spec) {
|
||||
// var result = spec.results();
|
||||
// var msg = '';
|
||||
// if (result.passed())
|
||||
// {
|
||||
// msg = (colors) ? (ansi.green + '.' + ansi.none) : '.';
|
||||
// // } else if (result.skipped) { TODO: Research why "result.skipped" returns false when "xit" is called on a spec?
|
||||
// // msg = (colors) ? (ansi.yellow + '*' + ansi.none) : '*';
|
||||
// } else {
|
||||
// msg = (colors) ? (ansi.red + 'F' + ansi.none) : 'F';
|
||||
// }
|
||||
// sys.print(msg);
|
||||
// if (columnCounter++ < 50) return;
|
||||
// columnCounter = 0;
|
||||
// sys.print('\n');
|
||||
// },
|
||||
|
||||
|
||||
|
||||
describe('A Test Run', function(){
|
||||
|
||||
describe('A spec runs', function(){
|
||||
|
||||
it("prints a green dot if the spec passes", function(){
|
||||
var passingSpec = {
|
||||
results: function(){
|
||||
return {passed:function(){return true;}};
|
||||
}
|
||||
};
|
||||
this.reporter.reportSpecResults(passingSpec);
|
||||
|
||||
expect(this.fakeSys.getOutput()).toEqual(
|
||||
green(".")
|
||||
);
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
});
|
||||
Reference in New Issue
Block a user