masylum/testosterone

possible EventEmitter memory leak detected. 11 listeners added. Use emitter.setMaxListeners() to increase limit.

iloire opened this issue · 1 comments

Hi!

I am running node v0.6.6 with testosterone v 1.3.0
I am using testosterone to do some simple http get testing against my node.js app.

If I create more than 10 get requests I get the following error:

✓ ✓ ✓ ✓ ✓ ✓ ✓ ✓ ✓ ✓ ✓ ✓ ✓ ✓ ✓ ✓ ✓ ✓ ✓ ✓ ✓ (node) warning: possible EventEmitter memory leak detected. 11 listeners added. Use emitter.setMaxListeners() to increase limit.
Trace:
at Socket. (events.js:133:17)
at ClientRequest. (http.js:1517:7)
at ClientRequest.emit (events.js:88:20)
at Array.0 (http.js:1237:9)
at EventEmitter._tickCallback (node.js:192:40)
✓ ✓ ✓ ✓ ✓ ✓ ✓ ✓ ✓ ✓ ✓ ✓ » 15 responses, 33 asserts, 1.42s

This is my code:

var testosterone = require('testosterone')({port: 3000, sync: true})
, assert = testosterone.assert;

testosterone
/MAIN/
.get('/', function (res) {
assert.equal(res.statusCode, 200)
})

.get('/directory', function (res) {
  assert.equal(res.statusCode, 200)
})

 /*REST*/
//cats
.get('/api/cats', function (res) {
    assert.equal(res.statusCode, 200);
    assert.ok(res.body.indexOf ('{"cats":')>-1);
})

//cats jsonp
.get('/api/cats?callback=test', function (res) {
    assert.equal(res.statusCode, 200);
    assert.ok(res.body.indexOf ('test({"cats":')>-1);
})

//tags
.get('/api/tags', function (res) {
    assert.equal(res.statusCode, 200);
    assert.ok(res.body.indexOf ('{"tags":')>-1);
})

//tags jsonp
.get('/api/tags?callback=test', function (res) {
    assert.equal(res.statusCode, 200);
    assert.ok(res.body.indexOf ('test({"tags":')>-1);
})

//tags autocomplete
.get('/api/tagsautocomplete', function (res) {
    assert.equal(res.statusCode, 200);
    assert.ok(res.body.indexOf ('c#')>-1);
})

//users by cat
.get('/api/users/bycat?id=1', function (res) {
    assert.equal(res.statusCode, 200);
    assert.ok(res.body.indexOf ('Loire')>-1);
    assert.ok(res.body.indexOf('email')==-1); //make sure email is not returned for public calls
})

//users by cat jsonp
.get('/api/users/bycat?id=1&callback=test', function (res) {
    assert.equal(res.statusCode, 200);
    assert.ok(res.body.indexOf ('test({"users":[')>-1);
    assert.ok(res.body.indexOf ('Loire')>-1);
})

//users by tag
.get('/api/users/bytag?id=node.js', function (res) {
    assert.equal(res.statusCode, 200);
    assert.ok(res.body.indexOf ('Loire')>-1);
    assert.ok(res.body.indexOf('email')==-1); //make sure email is not returned for public calls
})

//users by tag jsonp
.get('/api/users/bytag?id=node.js&callback=test', function (res) {
    assert.equal(res.statusCode, 200);
    assert.ok(res.body.indexOf ('test({"users":[')>-1); 
    assert.ok(res.body.indexOf ('Loire')>-1);
    assert.ok(res.body.indexOf('email')==-1); //make sure email is not returned for public calls
})

//user by id
.get('/api/users/byid?id=1', function (res) {
    assert.equal(res.statusCode, 200);
    assert.ok(res.body.indexOf ('Loire')>-1);
    assert.ok(res.body.indexOf('email')==-1); //make sure email is not returned for public calls
})

//user by id jsonp
.get('/api/users/byid?id=1&callback=test', function (res) {
    assert.equal(res.statusCode, 200);
    assert.ok(res.body.indexOf ('test({"user":')>-1);
    assert.ok(res.body.indexOf ('Loire')>-1);
})

//search
.get('/api/search?q=Zufaria', function (res) {
  assert.equal(res.statusCode, 200);
  assert.ok(res.body.indexOf ('Loire')>-1);
})

//search
.get('/editprofile', function (res) {
  //assert.equal(res.statusCode, 200, res.statusCode);
})

Thanks for reporting the issue. Closed by commit: 4ab0715