2020-06-11 17:59:11 +02:00
|
|
|
// What this script does:
|
2020-08-05 16:18:28 +02:00
|
|
|
// 1. Removes the old test folder if it exists (.budibase)
|
|
|
|
// 2. Initialises using `.budibase`
|
2020-06-11 17:59:11 +02:00
|
|
|
// 3. Runs the server using said folder
|
|
|
|
|
2020-06-11 18:14:28 +02:00
|
|
|
const rimraf = require("rimraf")
|
2020-06-11 21:37:01 +02:00
|
|
|
const { join } = require("path")
|
|
|
|
const run = require("../../cli/src/commands/run/runHandler")
|
2020-08-05 16:18:28 +02:00
|
|
|
const initialiseBudibase = require("../../server/src/utilities/initialiseBudibase")
|
|
|
|
|
|
|
|
const homedir = join(require("os").homedir(), ".budibase")
|
2020-06-11 17:59:11 +02:00
|
|
|
|
2020-06-11 18:10:53 +02:00
|
|
|
rimraf.sync(homedir)
|
2020-06-11 17:59:11 +02:00
|
|
|
|
2020-08-05 16:18:28 +02:00
|
|
|
process.env.BUDIBASE_API_KEY = "6BE826CB-6B30-4AEC-8777-2E90464633DE"
|
|
|
|
process.env.NODE_ENV = "cypress"
|
|
|
|
|
|
|
|
initialiseBudibase({ dir: homedir, clientId: "cypress-test" })
|
|
|
|
.then(() => {
|
|
|
|
delete require.cache[require.resolve("../../server/src/environment")]
|
|
|
|
run({ dir: homedir })
|
|
|
|
})
|
|
|
|
.catch(e => console.error(e))
|