2021-02-03 17:09:48 +01:00
|
|
|
const cypressConfig = require("../cypress.json")
|
2021-03-24 16:36:13 +01:00
|
|
|
const path = require("path")
|
|
|
|
|
|
|
|
const tmpdir = path.join(require("os").tmpdir(), ".budibase")
|
2020-08-05 16:18:28 +02:00
|
|
|
|
|
|
|
process.env.BUDIBASE_API_KEY = "6BE826CB-6B30-4AEC-8777-2E90464633DE"
|
|
|
|
process.env.NODE_ENV = "cypress"
|
2020-09-29 18:28:24 +02:00
|
|
|
process.env.ENABLE_ANALYTICS = "false"
|
2021-02-03 17:09:48 +01:00
|
|
|
process.env.PORT = cypressConfig.env.PORT
|
2021-03-24 16:36:13 +01:00
|
|
|
process.env.JWT_SECRET = cypressConfig.env.JWT_SECRET
|
|
|
|
process.env.COUCH_URL = `leveldb://${tmpdir}/.data/`
|
2020-08-05 16:18:28 +02:00
|
|
|
|
2020-12-01 15:35:47 +01:00
|
|
|
// Stop info logs polluting test outputs
|
|
|
|
process.env.LOG_LEVEL = "error"
|
|
|
|
|
2021-03-23 12:01:33 +01:00
|
|
|
async function run() {
|
|
|
|
// require("dotenv").config({ path: resolve(dir, ".env") })
|
2020-10-28 12:23:26 +01:00
|
|
|
|
|
|
|
// dont make this a variable or top level require
|
|
|
|
// it will cause environment module to be loaded prematurely
|
|
|
|
const server = require("../../server/src/app")
|
|
|
|
server.on("close", () => console.log("Server Closed"))
|
|
|
|
}
|
|
|
|
|
2021-03-23 12:01:33 +01:00
|
|
|
run()
|
|
|
|
|
|
|
|
// TODO: ensure that this still works
|
|
|
|
// initialiseBudibase({ dir: homedir, clientId: "cypress-test" })
|
|
|
|
// .then(() => {
|
|
|
|
// delete require.cache[require.resolve("../../server/src/environment")]
|
|
|
|
// const xPlatHomeDir = homedir.startsWith("~")
|
|
|
|
// ? join(homedir(), homedir.substring(1))
|
|
|
|
// : homedir
|
|
|
|
// run(xPlatHomeDir)
|
|
|
|
// })
|
|
|
|
// .catch(e => console.error(e))
|