test-query-after-end.js 503 B

123456789101112131415161718192021222324
  1. var common = require('../../common');
  2. var connection = common.createConnection();
  3. var assert = require('assert');
  4. var didEnd = false;
  5. connection.connect();
  6. connection.end(function(err) {
  7. if (err) throw err;
  8. didEnd = true;
  9. });
  10. var err;
  11. connection.query('SELECT 1', function(_err) {
  12. assert.equal(didEnd, false);
  13. err = _err;
  14. });
  15. process.on('exit', function() {
  16. assert.equal(didEnd, true);
  17. assert.equal(err.code, 'PROTOCOL_ENQUEUE_AFTER_QUIT');
  18. assert.equal(err.fatal, false);
  19. });