From 2f44dbf53ed5800ae587e89682c77e70893cfd2e Mon Sep 17 00:00:00 2001 From: osher Date: Wed, 5 Nov 2014 11:58:09 +0200 Subject: [PATCH] 0.8 compatibility --- test/connect-logger-test.js | 2 +- test/nolog-test.js | 7 +++++-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/test/connect-logger-test.js b/test/connect-logger-test.js index 562a808..96d0409 100644 --- a/test/connect-logger-test.js +++ b/test/connect-logger-test.js @@ -41,7 +41,7 @@ function MockRequest(remoteAddr, method, originalUrl, headers) { function MockResponse() { var r = this; this.end = function(chunk, encoding) { - setImmediate(function(){ r.emit('finish') }); + r.emit('finish'); }; this.writeHead = function(code, headers) { diff --git a/test/nolog-test.js b/test/nolog-test.js index 79f8095..1ad957d 100644 --- a/test/nolog-test.js +++ b/test/nolog-test.js @@ -37,7 +37,7 @@ function MockResponse(statusCode) { this.statusCode = statusCode; this.end = function(chunk, encoding) { - setImmediate(function(){ r.emit('finish') }); + r.emit('finish'); }; } util.inherits(MockResponse, EE); @@ -87,9 +87,12 @@ vows.describe('log4js connect logger').addBatch({ topic: function(d) { var req = new MockRequest('my.remote.addr', 'GET', 'http://url/hoge.gif'); // gif var res = new MockResponse(200); + var cb = this.callback; d.cl(req, res, function() { }); res.end('chunk', 'encoding'); - return d.ml.messages; + setTimeout(function() { + cb(null, d.ml.messages); + },10); }, 'check message': function(messages) { assert.isArray(messages);