Skip to content

Commit 3675d2b

Browse files
committed
Fix to support node@4 LTS
1 parent a720dc7 commit 3675d2b

File tree

7 files changed

+16
-5
lines changed

7 files changed

+16
-5
lines changed

index.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@ Cursor.prototype.handleError = function(msg) {
114114
this._queue.pop()[1](msg)
115115
}
116116

117-
if (this.eventNames().indexOf('error') >= 0) {
117+
if (this.listenerCount('error') > 0) {
118118
//only dispatch error events if we have a listener
119119
this.emit('error', msg)
120120
}

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
"test": "test"
88
},
99
"scripts": {
10-
"test": "mocha test"
10+
"test": "mocha"
1111
},
1212
"author": "Brian M. Carlson",
1313
"license": "MIT",

test/error-handling.js

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
'use strict'
12
var assert = require('assert')
23
var Cursor = require('../')
34
var pg = require('pg')
@@ -70,7 +71,7 @@ describe('proper cleanup', function () {
7071
cursor1.read(8, function (err, rows) {
7172
assert.ifError(err)
7273
assert.equal(rows.length, 5)
73-
cursor2 = client.query(new Cursor(text))
74+
var cursor2 = client.query(new Cursor(text))
7475
cursor2.read(8, function (err, rows) {
7576
assert.ifError(err)
7677
assert.equal(rows.length, 5)

test/index.js

-1
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,6 @@ describe('cursor', function() {
3030
})
3131
})
3232

33-
for (var i = 0; i < 100; i++)
3433
it('end before reading to end', function(done) {
3534
var cursor = this.pgCursor(text)
3635
cursor.read(3, function(err, res) {

test/mocha.opts

+1
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
1+
--reporter spec
12
--no-exit
23
--bail

test/pool.js

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
'use strict'
12
const assert = require('assert')
23
const Cursor = require('../')
34
const pg = require('pg')
@@ -82,4 +83,4 @@ describe('pool', function() {
8283
done()
8384
})
8485
})
85-
})
86+
})

test/result-config.js

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
var assert = require('assert')
2+
var Cursor = require('../')
3+
var pg = require('pg')
4+
5+
describe('Custom query config', () => {
6+
it('supports row mode array', () => {
7+
8+
})
9+
})

0 commit comments

Comments
 (0)