Fix to support node@4 LTS

This commit is contained in:
Brian M. Carlson 2017-08-05 17:17:24 -05:00
parent a720dc774b
commit 3675d2b041
7 changed files with 16 additions and 5 deletions

View File

@ -114,7 +114,7 @@ Cursor.prototype.handleError = function(msg) {
this._queue.pop()[1](msg)
}
if (this.eventNames().indexOf('error') >= 0) {
if (this.listenerCount('error') > 0) {
//only dispatch error events if we have a listener
this.emit('error', msg)
}

View File

@ -7,7 +7,7 @@
"test": "test"
},
"scripts": {
"test": "mocha test"
"test": "mocha"
},
"author": "Brian M. Carlson",
"license": "MIT",

View File

@ -1,3 +1,4 @@
'use strict'
var assert = require('assert')
var Cursor = require('../')
var pg = require('pg')
@ -70,7 +71,7 @@ describe('proper cleanup', function () {
cursor1.read(8, function (err, rows) {
assert.ifError(err)
assert.equal(rows.length, 5)
cursor2 = client.query(new Cursor(text))
var cursor2 = client.query(new Cursor(text))
cursor2.read(8, function (err, rows) {
assert.ifError(err)
assert.equal(rows.length, 5)

View File

@ -30,7 +30,6 @@ describe('cursor', function() {
})
})
for (var i = 0; i < 100; i++)
it('end before reading to end', function(done) {
var cursor = this.pgCursor(text)
cursor.read(3, function(err, res) {

View File

@ -1,2 +1,3 @@
--reporter spec
--no-exit
--bail

View File

@ -1,3 +1,4 @@
'use strict'
const assert = require('assert')
const Cursor = require('../')
const pg = require('pg')
@ -82,4 +83,4 @@ describe('pool', function() {
done()
})
})
})
})

9
test/result-config.js Normal file
View File

@ -0,0 +1,9 @@
var assert = require('assert')
var Cursor = require('../')
var pg = require('pg')
describe('Custom query config', () => {
it('supports row mode array', () => {
})
})