From 4006bddbcfeec5b6cb0afed081bf9726eefa9b12 Mon Sep 17 00:00:00 2001 From: Brian Lauber Date: Fri, 6 Mar 2020 16:26:34 -0500 Subject: [PATCH] Fixed a few unhandled Promise rejections in a test case (#3705) --- test/index.js | 3 +-- test/integration/schema/index.js | 15 ++++++++++----- 2 files changed, 11 insertions(+), 7 deletions(-) diff --git a/test/index.js b/test/index.js index f465f800ec..adcb07fed2 100644 --- a/test/index.js +++ b/test/index.js @@ -9,8 +9,7 @@ global.chai.use(require('sinon-chai')); global.d = new Date(); -// '.timeout(ms, {cancel: true}) should throw error if cancellation cannot acquire connection' produced unhandled rejection and it's unclear how to avoid that -const EXPECTED_REJECTION_COUNT = 2; +const EXPECTED_REJECTION_COUNT = 0; const rejectionLog = []; process.on('unhandledRejection', (reason) => { console.error('Unhandled rejection:', reason); diff --git a/test/integration/schema/index.js b/test/integration/schema/index.js index 554296fffa..67aa225a29 100644 --- a/test/integration/schema/index.js +++ b/test/integration/schema/index.js @@ -1671,7 +1671,8 @@ module.exports = (knex) => { .then(() => { if (/sqlite/i.test(knex.client.dialect)) { //For SQLite inspect metadata to make sure the constraint exists - tr.select('type', 'name', 'tbl_name', 'sql') + return tr + .select('type', 'name', 'tbl_name', 'sql') .from('sqlite_master') .where({ type: 'table', @@ -1702,7 +1703,8 @@ module.exports = (knex) => { .then(() => { if (/sqlite/i.test(knex.client.dialect)) { //For SQLite inspect metadata to make sure the constraint exists - tr.select('type', 'name', 'tbl_name', 'sql') + return tr + .select('type', 'name', 'tbl_name', 'sql') .from('sqlite_master') .where({ type: 'table', @@ -1746,7 +1748,8 @@ module.exports = (knex) => { '` primary key (`test`, `test2`))', }, ]; - tr.select('type', 'name', 'tbl_name', 'sql') + return tr + .select('type', 'name', 'tbl_name', 'sql') .from('sqlite_master') .where({ type: 'table', @@ -1798,7 +1801,8 @@ module.exports = (knex) => { '` (`test`)', }, ]; - tr.select('type', 'name', 'tbl_name', 'sql') + return tr + .select('type', 'name', 'tbl_name', 'sql') .from('sqlite_master') .where({ type: 'index', @@ -1861,7 +1865,8 @@ module.exports = (knex) => { '` (`test`, `test2`)', }, ]; - tr.select('type', 'name', 'tbl_name', 'sql') + return tr + .select('type', 'name', 'tbl_name', 'sql') .from('sqlite_master') .where({ type: 'index',