From 49f51199f7af4c7dd5c8ecd79cf33386250fb55f Mon Sep 17 00:00:00 2001 From: tomg10 Date: Thu, 9 Nov 2023 00:14:18 +0100 Subject: [PATCH] feat: TS_INTEGRATION_PRESERVE_TEST_DATABASES flag --- core/tests/ts-integration/src/context-owner.ts | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/core/tests/ts-integration/src/context-owner.ts b/core/tests/ts-integration/src/context-owner.ts index adcdfe61e1eb..2bdd61403ea6 100644 --- a/core/tests/ts-integration/src/context-owner.ts +++ b/core/tests/ts-integration/src/context-owner.ts @@ -426,10 +426,16 @@ export class TestContextOwner { if (databaseUrl.trim().length == 0) { continue; //sanity check, we really don't want sqlx to delete main postgres database } - await utils.spawn(`cargo sqlx database drop -y --database-url ${databaseUrl}`); + if (process.env.TS_INTEGRATION_PRESERVE_TEST_DATABASES === undefined) { + await utils.spawn(`cargo sqlx database drop -y --database-url ${databaseUrl}`); + } else { + console.log(`skipped cleaning ${databaseUrl}`); + } } catch (e) {} } - fs.rmSync(filepath); + if (process.env.TS_INTEGRATION_PRESERVE_TEST_DATABASES === undefined) { + fs.rmSync(filepath); + } this.reporter.finishAction(); }