node-postgres/test/integration/client/deprecation-tests.js
Daniel García Aubert 37e731940b Support Node.js 10
2018-11-02 18:45:48 +01:00

25 lines
583 B
JavaScript

var helper = require('./test-helper')
process.on('warning', function (warning) {
console.log(warning)
if (warning.message.startsWith('Buffer() is deprecated')) return
throw new Error('Should not emit deprecation warning')
})
var client = new helper.pg.Client()
client.connect(function (err) {
if (err) throw err
client.query('SELECT NOW()')
.then(function (res) {
client.query('SELECT NOW()', function () {
client.end(function () {
})
})
}).catch(function (err) {
setImmediate(function () {
throw err
})
})
})