Upgrade to test on node 10 (#114)

* Upgrade to test on node 10

* Use errno instead of code

* Only check errno if it exists
This commit is contained in:
Brian C 2019-01-02 12:11:21 -06:00 committed by GitHub
parent f91769538d
commit 4d2ad36951
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 2120 additions and 9 deletions

View File

@ -12,6 +12,6 @@ matrix:
- node_js: "8"
addons:
postgresql: "9.6"
- node_js: "9"
- node_js: "10"
addons:
postgresql: "9.6"

2106
package-lock.json generated Normal file

File diff suppressed because it is too large Load Diff

View File

@ -29,12 +29,12 @@
"bluebird": "3.4.1",
"co": "4.6.0",
"expect.js": "0.3.1",
"lodash": "4.13.1",
"mocha": "^2.3.3",
"lodash": "^4.17.11",
"mocha": "^5.2.0",
"pg": "*",
"pg-cursor": "^1.3.0",
"standard": "7.1.2",
"standard-format": "2.2.1"
"standard-format": "^2.2.4"
},
"dependencies": {},
"peerDependencies": {

View File

@ -15,6 +15,9 @@ describe('connection timeout', () => {
before((done) => {
this.server = net.createServer((socket) => {
socket.on('data', () => {
// discard any buffered data or the server wont terminate
})
})
this.server.listen(() => {

View File

@ -154,11 +154,15 @@ describe('pool error handling', function () {
const pool = new Pool({ max: 1, port: closeServer.address().port })
pool.connect((err) => {
expect(err).to.be.an(Error)
expect(err.message).to.be('Connection terminated unexpectedly')
if (err.errno) {
expect(err.errno).to.be('ECONNRESET')
}
})
pool.connect((err) => {
expect(err).to.be.an(Error)
expect(err.message).to.be('Connection terminated unexpectedly')
if (err.errno) {
expect(err.errno).to.be('ECONNRESET')
}
closeServer.close(() => {
pool.end(done)
})

View File

@ -23,14 +23,13 @@ describe('events', function () {
})
})
it('emits "connect" only with a successful connection', function (done) {
it('emits "connect" only with a successful connection', function () {
const pool = new Pool({
// This client will always fail to connect
Client: mockClient({
connect: function (cb) {
process.nextTick(() => {
cb(new Error('bad news'))
setImmediate(done)
})
}
})

View File

@ -1,4 +1,3 @@
--require test/setup.js
--no-exit
--bail
--timeout 10000