1
0
Fork 0
mirror of synced 2024-06-25 17:40:38 +12:00
budibase/packages/builder/cypress/setup.js

39 lines
1.3 KiB
JavaScript
Raw Normal View History

2020-06-12 03:59:11 +12:00
// What this script does:
// 1. Removes the old test folder if it exists (.budibase)
// 2. Initialises using `.budibase`
2020-06-12 03:59:11 +12:00
// 3. Runs the server using said folder
2020-10-29 00:23:26 +13:00
const { join, resolve } = require("path")
const initialiseBudibase = require("../../server/src/utilities/initialiseBudibase")
const cypressConfig = require("../cypress.json")
process.env.BUDIBASE_API_KEY = "6BE826CB-6B30-4AEC-8777-2E90464633DE"
process.env.NODE_ENV = "cypress"
process.env.ENABLE_ANALYTICS = "false"
process.env.PORT = cypressConfig.env.PORT
2020-12-02 03:35:47 +13:00
// Stop info logs polluting test outputs
process.env.LOG_LEVEL = "error"
2021-03-24 00:01:33 +13:00
async function run() {
// require("dotenv").config({ path: resolve(dir, ".env") })
2020-10-29 00:23:26 +13: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-24 00:01:33 +13: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))