Move more stuff to .env.test
This commit is contained in:
parent
d6f0e5b1ec
commit
d1d8ce3611
|
@ -1,3 +1,7 @@
|
|||
JWT_SECRET=testsecret
|
||||
COUCH_DB_PASSWORD=test_couchdb_user
|
||||
COUCH_DB_USER=test_couchdb_password
|
||||
COUCHDB_USER=test_couchdb_user
|
||||
COUCH_DB_USER=test_couchdb_user
|
||||
COUCHDB_PASSWORD=test_couchdb_password
|
||||
COUCH_DB_PASSWORD=test_couchdb_password
|
||||
MINIO_ACCESS_KEY=budibase
|
||||
MINIO_SECRET_KEY=budibase
|
|
@ -21,20 +21,11 @@ function isCypress() {
|
|||
}
|
||||
|
||||
let LOADED = false
|
||||
if (!LOADED) {
|
||||
if (isDev() && !isTest()) {
|
||||
require("dotenv").config({
|
||||
path: join(__dirname, "..", ".env"),
|
||||
})
|
||||
LOADED = true
|
||||
}
|
||||
// TODO: remove when all tests (cypress, e2e, unit, etc) use docker for testing dependencies
|
||||
else if (isJest()) {
|
||||
require("dotenv").config({
|
||||
path: join(__dirname, "..", ".env.test"),
|
||||
})
|
||||
LOADED = true
|
||||
}
|
||||
if (!LOADED && isDev() && !isTest()) {
|
||||
require("dotenv").config({
|
||||
path: join(__dirname, "..", ".env"),
|
||||
})
|
||||
LOADED = true
|
||||
}
|
||||
|
||||
function parseIntSafe(number?: string) {
|
||||
|
|
|
@ -1,10 +1,8 @@
|
|||
import env from "../environment"
|
||||
import { env as coreEnv } from "@budibase/backend-core"
|
||||
import { tmpdir } from "os"
|
||||
|
||||
env._set("SELF_HOSTED", "1")
|
||||
env._set("NODE_ENV", "jest")
|
||||
env._set("JWT_SECRET", "test-jwtsecret")
|
||||
env._set("CLIENT_ID", "test-client-id")
|
||||
// @ts-ignore
|
||||
env._set("BUDIBASE_DIR", tmpdir("budibase-unittests"))
|
||||
|
@ -13,5 +11,3 @@ env._set("PORT", 0)
|
|||
env._set("MINIO_URL", "http://localhost")
|
||||
env._set("MINIO_ACCESS_KEY", "test")
|
||||
env._set("MINIO_SECRET_KEY", "test")
|
||||
coreEnv._set("COUCH_DB_USER", "budibase")
|
||||
coreEnv._set("COUCH_DB_PASSWORD", "budibase")
|
||||
|
|
|
@ -23,13 +23,18 @@ function overrideConfigValue(key: string, value: string) {
|
|||
coreEnv._set(key, value)
|
||||
}
|
||||
|
||||
overrideConfigValue("COUCH_DB_PORT", global.__TESTCONTAINERS_DEVENV_PORT_5984__)
|
||||
const globalSafe = global as any
|
||||
|
||||
overrideConfigValue(
|
||||
"COUCH_DB_PORT",
|
||||
globalSafe.__TESTCONTAINERS_DEVENV_PORT_5984__
|
||||
)
|
||||
overrideConfigValue(
|
||||
"COUCH_DB_URL",
|
||||
`http://${global.__TESTCONTAINERS_DEVENV_IP__}:${global.__TESTCONTAINERS_DEVENV_PORT_5984__}`
|
||||
`http://${globalSafe.__TESTCONTAINERS_DEVENV_IP__}:${globalSafe.__TESTCONTAINERS_DEVENV_PORT_5984__}`
|
||||
)
|
||||
|
||||
overrideConfigValue(
|
||||
"MINIO_URL",
|
||||
`http://${global.__TESTCONTAINERS_DEVENV_IP__}:${global.__TESTCONTAINERS_DEVENV_PORT_9000__}`
|
||||
`http://${globalSafe.__TESTCONTAINERS_DEVENV_IP__}:${globalSafe.__TESTCONTAINERS_DEVENV_PORT_9000__}`
|
||||
)
|
||||
|
|
Loading…
Reference in New Issue