Comparing version 0.1.0 to 0.1.1
@@ -113,3 +113,6 @@ 'use strict'; | ||
{ | ||
self.emit('error', error); | ||
if (self.listeners('error').length > 0) | ||
{ | ||
self.emit('error', error); | ||
} | ||
if (self.options.showErrors) | ||
@@ -116,0 +119,0 @@ { |
{ | ||
"name": "inits", | ||
"version": "0.1.0", | ||
"version": "0.1.1", | ||
"description": "Init system for Node.js.", | ||
@@ -5,0 +5,0 @@ "homepage": "https://github.com/alexfernandez/inits", |
@@ -152,3 +152,3 @@ 'use strict'; | ||
function testExceptions(callback) | ||
function testErrors(callback) | ||
{ | ||
@@ -198,2 +198,24 @@ var system = new inits.InitSystem(); | ||
function testErrorWithoutListener(callback) | ||
{ | ||
var system = new inits.InitSystem(); | ||
system.options.exitProcess = false; | ||
system.options.showErrors = false; | ||
var finish = false; | ||
system.init(function(next) | ||
{ | ||
next('init1'); | ||
}); | ||
system.finish(function(next) | ||
{ | ||
finish = true; | ||
next(null); | ||
}); | ||
system.on('end', function() | ||
{ | ||
testing.assert(finish, 'Should have finished', callback); | ||
testing.success(callback); | ||
}); | ||
} | ||
/** | ||
@@ -208,3 +230,4 @@ * Run all tests. | ||
testSeveralCallbacks, | ||
testExceptions, | ||
testErrors, | ||
testErrorWithoutListener, | ||
], callback); | ||
@@ -211,0 +234,0 @@ }; |
25512
640