mirror of
https://github.com/brianc/node-postgres.git
synced 2026-01-18 15:55:05 +00:00
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:
parent
f91769538d
commit
4d2ad36951
@ -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
2106
package-lock.json
generated
Normal file
File diff suppressed because it is too large
Load Diff
@ -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": {
|
||||
|
||||
@ -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(() => {
|
||||
|
||||
@ -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)
|
||||
})
|
||||
|
||||
@ -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)
|
||||
})
|
||||
}
|
||||
})
|
||||
|
||||
@ -1,4 +1,3 @@
|
||||
--require test/setup.js
|
||||
--no-exit
|
||||
--bail
|
||||
--timeout 10000
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user