From 655c6ec38150e610bf1b3d8be39337180f9ebd78 Mon Sep 17 00:00:00 2001 From: mike12345567 Date: Fri, 25 Jun 2021 16:37:01 +0100 Subject: [PATCH] Fixing cypress test linkup to built files. --- packages/builder/cypress/setup.js | 8 +++++++- packages/server/package.json | 4 ++-- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/packages/builder/cypress/setup.js b/packages/builder/cypress/setup.js index 0aa43308af..2c09c4b3c5 100644 --- a/packages/builder/cypress/setup.js +++ b/packages/builder/cypress/setup.js @@ -4,6 +4,8 @@ const path = require("path") const tmpdir = path.join(require("os").tmpdir(), ".budibase") // these run on ports we don't normally use so that they can run alongside the +const fs = require("fs") + // normal development system const WORKER_PORT = "10002" const MAIN_PORT = cypressConfig.env.PORT @@ -27,10 +29,14 @@ process.env.LOG_LEVEL = "error" async function run() { // 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 // 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 const worker = require("../../worker/src/index") // reload main port for rest of system diff --git a/packages/server/package.json b/packages/server/package.json index 17570fa15a..ff0344fb87 100644 --- a/packages/server/package.json +++ b/packages/server/package.json @@ -9,11 +9,11 @@ "url": "https://github.com/Budibase/budibase.git" }, "scripts": { - "build": "tsc", + "build": "tsc && mv dist/src/* dist/ && rmdir dist/src/", "test": "jest --coverage --maxWorkers=2", "test:watch": "jest --watch", "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:down": "node scripts/dev/manage.js down", "dev:stack:nuke": "node scripts/dev/manage.js nuke",