1
0
Fork 0
mirror of synced 2024-05-18 11:23:28 +12:00
budibase/packages/builder/cypress/setup.js

48 lines
1.5 KiB
JavaScript
Raw Normal View History

const cypressConfig = require("../cypress.json")
2021-03-25 04:36:13 +13:00
const path = require("path")
const tmpdir = path.join(require("os").tmpdir(), ".budibase")
// normal development system
const SERVER_PORT = cypressConfig.env.PORT
const WORKER_PORT = cypressConfig.env.WORKER_PORT
process.env.NODE_ENV = "cypress"
2022-05-24 09:14:44 +12:00
process.env.ENABLE_ANALYTICS = "0"
2021-03-25 04:36:13 +13:00
process.env.JWT_SECRET = cypressConfig.env.JWT_SECRET
process.env.COUCH_URL = `leveldb://${tmpdir}/.data/`
2021-03-25 10:15:14 +13:00
process.env.SELF_HOSTED = 1
process.env.WORKER_URL = `http://localhost:${WORKER_PORT}/`
process.env.APPS_URL = `http://localhost:${SERVER_PORT}/`
process.env.MINIO_URL = `http://localhost:4004`
2021-03-25 10:15:14 +13:00
process.env.MINIO_ACCESS_KEY = "budibase"
process.env.MINIO_SECRET_KEY = "budibase"
process.env.COUCH_DB_USER = "budibase"
process.env.COUCH_DB_PASSWORD = "budibase"
process.env.INTERNAL_API_KEY = "budibase"
process.env.ALLOW_DEV_AUTOMATIONS = 1
2020-12-02 03:35:47 +13:00
// Stop info logs polluting test outputs
process.env.LOG_LEVEL = "error"
exports.run = (
serverLoc = "../../server/dist",
workerLoc = "../../worker/dist"
) => {
2021-03-24 00:01:33 +13:00
// require("dotenv").config({ path: resolve(dir, ".env") })
// don't make this a variable or top level require
2020-10-29 00:23:26 +13:00
// it will cause environment module to be loaded prematurely
// override the port with the worker port temporarily
process.env.PORT = WORKER_PORT
require(workerLoc)
// override the port with the server port
process.env.PORT = SERVER_PORT
require(serverLoc)
2020-10-29 00:23:26 +13:00
}
if (require.main === module) {
exports.run()
}