From c2b399fc2ca250a9da6c7b0da74f13e42d0818a3 Mon Sep 17 00:00:00 2001 From: Daniel Lockyer Date: Wed, 31 Aug 2022 11:37:54 +0100 Subject: [PATCH] Fixed warning about aborted connection in tests refs https://github.com/TryGhost/Toolbox/issues/389 - if we enable warning logs in E2E tests, we get a bunch of error messages saying `ERROR Unhandled rejection: aborted` coming from the SQLite DB reset code - specifically, it's coming from the line that resets the DB by copying the file - this line was initially added because we would see random SQLite "malformed database" errors - I have a feeling that was due to something else, but I can't be sure - I'm also not sure how else we should shut the DB connection, as this is the recommended way but it throws an unhandled rejection - this commit is a bit of a gamble because I'm not actually sure what was causing the problem, but it gets rid of the errors locally and doesn't regress on the random failures --- ghost/core/test/utils/db-utils.js | 1 - 1 file changed, 1 deletion(-) diff --git a/ghost/core/test/utils/db-utils.js b/ghost/core/test/utils/db-utils.js index 868a8b6ee1..e7335b770c 100644 --- a/ghost/core/test/utils/db-utils.js +++ b/ghost/core/test/utils/db-utils.js @@ -48,7 +48,6 @@ module.exports.reset = async ({truncate} = {truncate: false}) => { const filenameOrig = `${filename}-orig`; if (dbInitialized) { - await db.knex.destroy(); await fs.copyFile(filenameOrig, filename); } else { await fs.remove(filename);