test-fatal-auth-error-without-handlers.js 520 B

123456789101112131415161718192021
  1. var common = require('../../common');
  2. var connection = common.createConnection({password: common.bogusPassword});
  3. var assert = require('assert');
  4. connection.connect();
  5. connection.query('SELECT 1');
  6. var err;
  7. connection.on('error', function(_err) {
  8. assert.equal(err, undefined);
  9. err = _err;
  10. });
  11. connection.end();
  12. process.on('exit', function() {
  13. if (process.env.NO_GRANT == '1' && typeof err == 'undefined') return;
  14. assert.equal(err.code, 'ER_ACCESS_DENIED_ERROR');
  15. assert.equal(err.fatal, true);
  16. });