Skip to content
This repository has been archived by the owner on Nov 14, 2017. It is now read-only.

Commit

Permalink
small tweaks
Browse files Browse the repository at this point in the history
  • Loading branch information
garrensmith committed Sep 10, 2011
1 parent 70ebd32 commit e350374
Show file tree
Hide file tree
Showing 4 changed files with 34 additions and 14 deletions.
27 changes: 25 additions & 2 deletions bin/Jody
Expand Up @@ -36,6 +36,26 @@ var help = ''
+ '\n'
+ '\n If no file given, will look in ./specs for specs to run';

/*
process.on('uncaughtException', function (err) {
console.log('Caught exception: ');
if (typeof err === 'object') {
if (err.message) {
console.log('\nMessage: ' + err.message)
}
if (err.stack) {
console.log('\nStacktrace:')
console.log('====================')
console.log (err.stack);
}
if (err.error) {
//console.dir(err);
}
} else {
console.log('dumpError :: argument is not an object');
}});
*/

while (args.length) {
var arg = args.shift();
Expand Down Expand Up @@ -146,14 +166,17 @@ if (fileWatching == false) {

var specRunner = new runner.Runner();

specRunner.on('done', function () {
/*specRunner.on('done', function () {
reporter.displayResults();
if (reporter.failedSpecs) {
console.log("done fired");
process.exit(1);
}
console.log("done fired");
process.exit(0);
});
});*/

specRunner.run(Jody.specification_groups);

Expand Down
8 changes: 4 additions & 4 deletions lib/Jody.js
Expand Up @@ -23,10 +23,10 @@ var SpecificationGroup = function (description) {
self.specs = [];
self.active_specs = 0;

self.beforeEachFn = function (done) {done()};
self.afterAllFn = function (done) {done();};
self.afterEachFn = function (done) {done();};
self.beforeAllFn = function (done) {done()};
self.beforeEachFn = function (done) { done(); };
self.afterAllFn = function (done) { done(); };
self.afterEachFn = function (done) { done(); };
self.beforeAllFn = function (done) { done(); };

self.beforeEach = function (fn) {
self.beforeEachFn = fn;
Expand Down
10 changes: 5 additions & 5 deletions lib/httpClient.js
@@ -1,7 +1,7 @@
var http = require('http');


var HttpClient = module.exports = function (server, debug) {
var HttpClient = module.exports = function (server, port,debug) {
var self = this;
if (arguments.length === 2 && debug) {
self.debug = function (msg) {
Expand All @@ -10,8 +10,8 @@ var HttpClient = module.exports = function (server, debug) {
} else {
self.debug = function () {};
}


self.port = port || 8123;
var test_server = server;
test_server.connections = 0;

Expand All @@ -29,7 +29,7 @@ var HttpClient = module.exports = function (server, debug) {
self.request = function (request_options, cb) {
var options = {
host: '127.0.0.1',
port: 8123,
port: self.port,
path: request_options.url || '/',
method: request_options.method || 'GET',
body: self.processBody(request_options.body),
Expand All @@ -39,7 +39,7 @@ var HttpClient = module.exports = function (server, debug) {
self.debug("Connections: " + test_server.connections);
if (test_server.connections === 0) {
self.debug("starting server");
test_server.listen(8123, '127.0.0.1');
test_server.listen(self.port , '127.0.0.1');
}

test_server.connections += 1;
Expand Down
3 changes: 0 additions & 3 deletions lib/runner.js
Expand Up @@ -80,14 +80,12 @@ var SpecRunner = function () {
self.run_spec = function (done) {
var async_handler = new Async_Handler(self.spec, done);

// try_wrapper(self.spec, function () {
try{
self.spec.fn(async_handler.async_wrapper);

/* change this to a boolean check */
if (async_handler.active_cbs === 0) {
self.spec.passed = true;
//console.log("calling done for and I shouldnt");
done();
} else {
//check_callbacks_fired(async_handler);
Expand All @@ -96,7 +94,6 @@ var SpecRunner = function () {
self.spec.error = ex;
self.spec.passed = false;
}
// });

};

Expand Down

0 comments on commit e350374

Please sign in to comment.