From ffc322da88659f728d24c345b0654873787d02f8 Mon Sep 17 00:00:00 2001 From: Adria Navarro Date: Tue, 17 Jan 2023 16:05:02 +0000 Subject: [PATCH] Treat new tests are "no tests" --- packages/backend-core/src/environment.ts | 11 +++++++++++ packages/server/src/environment.ts | 11 +++++++++++ packages/worker/src/environment.ts | 10 ++++++++++ 3 files changed, 32 insertions(+) diff --git a/packages/backend-core/src/environment.ts b/packages/backend-core/src/environment.ts index 91556ddcd6..77328eedaf 100644 --- a/packages/backend-core/src/environment.ts +++ b/packages/backend-core/src/environment.ts @@ -1,4 +1,15 @@ +function isDockerisedTest() { + return process.env.DOCKERISED_TEST === "true" +} + function isTest() { + if (isDockerisedTest()) { + // While we are migrating all the tests to use docker instead of mocked in memory, + // we want to keep treating the old tests as tests, + // but the new tests should not make a difference + return false + } + return isCypress() || isJest() } diff --git a/packages/server/src/environment.ts b/packages/server/src/environment.ts index 6272e0e462..d11661ce27 100644 --- a/packages/server/src/environment.ts +++ b/packages/server/src/environment.ts @@ -1,6 +1,17 @@ import { join } from "path" +function isDockerisedTest() { + return process.env.DOCKERISED_TEST === "true" +} + function isTest() { + if (isDockerisedTest()) { + // While we are migrating all the tests to use docker instead of mocked in memory, + // we want to keep treating the old tests as tests, + // but the new tests should not make a difference + return false + } + return isCypress() || isJest() } diff --git a/packages/worker/src/environment.ts b/packages/worker/src/environment.ts index 52fec210bc..aab30883ea 100644 --- a/packages/worker/src/environment.ts +++ b/packages/worker/src/environment.ts @@ -4,7 +4,17 @@ function isDev() { return process.env.NODE_ENV !== "production" } +function isDockerisedTest() { + return process.env.DOCKERISED_TEST === "true" +} + function isTest() { + if (isDockerisedTest()) { + // While we are migrating all the tests to use docker instead of mocked in memory, + // we want to keep treating the old tests as tests, + // but the new tests should not make a difference + return false + } return ( process.env.NODE_ENV === "jest" || process.env.NODE_ENV === "cypress" ||