Fixing cypress test linkup to built files.

This commit is contained in:
mike12345567 2021-06-25 16:37:01 +01:00
parent d90f77fa42
commit 655c6ec381
2 changed files with 9 additions and 3 deletions

View File

@ -4,6 +4,8 @@ const path = require("path")
const tmpdir = path.join(require("os").tmpdir(), ".budibase") const tmpdir = path.join(require("os").tmpdir(), ".budibase")
// these run on ports we don't normally use so that they can run alongside the // these run on ports we don't normally use so that they can run alongside the
const fs = require("fs")
// normal development system // normal development system
const WORKER_PORT = "10002" const WORKER_PORT = "10002"
const MAIN_PORT = cypressConfig.env.PORT const MAIN_PORT = cypressConfig.env.PORT
@ -27,10 +29,14 @@ process.env.LOG_LEVEL = "error"
async function run() { async function run() {
// require("dotenv").config({ path: resolve(dir, ".env") }) // require("dotenv").config({ path: resolve(dir, ".env") })
if (!fs.existsSync("../server/dist")) {
console.error("Unable to run cypress, need to build server first")
process.exit(-1)
}
// dont make this a variable or top level require // dont make this a variable or top level require
// it will cause environment module to be loaded prematurely // it will cause environment module to be loaded prematurely
const server = require("../../server/src/app") const server = require("../../server/dist/app")
process.env.PORT = WORKER_PORT process.env.PORT = WORKER_PORT
const worker = require("../../worker/src/index") const worker = require("../../worker/src/index")
// reload main port for rest of system // reload main port for rest of system

View File

@ -9,11 +9,11 @@
"url": "https://github.com/Budibase/budibase.git" "url": "https://github.com/Budibase/budibase.git"
}, },
"scripts": { "scripts": {
"build": "tsc", "build": "tsc && mv dist/src/* dist/ && rmdir dist/src/",
"test": "jest --coverage --maxWorkers=2", "test": "jest --coverage --maxWorkers=2",
"test:watch": "jest --watch", "test:watch": "jest --watch",
"build:docker": "docker build . -t app-service", "build:docker": "docker build . -t app-service",
"run:docker": "node dist/src/index.js", "run:docker": "node dist/index.js",
"dev:stack:up": "node scripts/dev/manage.js up", "dev:stack:up": "node scripts/dev/manage.js up",
"dev:stack:down": "node scripts/dev/manage.js down", "dev:stack:down": "node scripts/dev/manage.js down",
"dev:stack:nuke": "node scripts/dev/manage.js nuke", "dev:stack:nuke": "node scripts/dev/manage.js nuke",