test-fatal-query-error-without-callback.js 437 B

1234567891011121314151617181920
  1. var common = require('../../common');
  2. var connection = common.createConnection({port: common.bogusPort});
  3. var assert = require('assert');
  4. connection.connect();
  5. var query = connection.query('SELECT 1');
  6. var err;
  7. query.on('error', function(_err) {
  8. assert.equal(err, undefined);
  9. err = _err;
  10. });
  11. connection.end();
  12. process.on('exit', function() {
  13. assert.equal(err.code, 'ECONNREFUSED');
  14. assert.equal(err.fatal, true);
  15. });