2023-01-24 05:45:06 +13:00
|
|
|
import env from "../environment"
|
|
|
|
import { env as coreEnv } from "@budibase/backend-core"
|
2022-05-31 08:46:08 +12:00
|
|
|
|
2022-12-16 00:35:22 +13:00
|
|
|
if (!process.env.DEBUG) {
|
|
|
|
global.console.log = jest.fn() // console.log are ignored in tests
|
|
|
|
global.console.warn = jest.fn() // console.warn are ignored in tests
|
|
|
|
}
|
2022-11-15 02:29:46 +13:00
|
|
|
|
|
|
|
if (!process.env.CI) {
|
|
|
|
// set a longer timeout in dev for debugging
|
|
|
|
// 100 seconds
|
|
|
|
jest.setTimeout(100000)
|
|
|
|
}
|
2023-01-24 05:45:06 +13:00
|
|
|
|
|
|
|
function overrideConfigValue(key: string, value: string) {
|
|
|
|
env._set(key, value)
|
|
|
|
coreEnv._set(key, value)
|
|
|
|
}
|
|
|
|
|
2023-01-24 07:02:28 +13:00
|
|
|
const globalSafe = global as any
|
|
|
|
|
2023-01-31 23:21:19 +13:00
|
|
|
console.log(global)
|
|
|
|
|
2023-01-24 07:02:28 +13:00
|
|
|
overrideConfigValue(
|
|
|
|
"COUCH_DB_PORT",
|
2023-01-31 07:18:23 +13:00
|
|
|
globalSafe["__TESTCONTAINERS_COUCHDB-SERVICE-1_PORT_5984__"]
|
2023-01-24 07:02:28 +13:00
|
|
|
)
|
2023-01-24 05:45:06 +13:00
|
|
|
overrideConfigValue(
|
|
|
|
"COUCH_DB_URL",
|
2023-01-31 07:18:23 +13:00
|
|
|
`http://${globalSafe["__TESTCONTAINERS_COUCHDB-SERVICE-1_IP__"]}:${globalSafe["__TESTCONTAINERS_COUCHDB-SERVICE-1_PORT_5984__"]}`
|
2023-01-24 05:45:06 +13:00
|
|
|
)
|
|
|
|
|
|
|
|
overrideConfigValue(
|
|
|
|
"MINIO_URL",
|
2023-01-31 07:18:23 +13:00
|
|
|
`http://${globalSafe["__TESTCONTAINERS_MINIO-SERVICE-1_IP__"]}:${globalSafe["__TESTCONTAINERS_MINIO-SERVICE-1_PORT_9000__"]}`
|
2023-01-24 05:45:06 +13:00
|
|
|
)
|