1
0
Fork 0
mirror of synced 2024-09-27 06:42:03 +12:00
budibase/packages/server/src/tests/jestSetup.ts

37 lines
989 B
TypeScript
Raw Normal View History

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
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
}
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:30:57 +13:00
console.error(global)
2023-01-31 23:21:19 +13:00
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
)