Skip to content

Commit

Permalink
attempting to fix mocha testing env on runner
Browse files Browse the repository at this point in the history
  • Loading branch information
adkinsrs committed Dec 14, 2023
1 parent 9a7db4d commit c1d2c47
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 3 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/mocha_tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,4 +44,4 @@ jobs:
run: npm test # alias to "mocha test"
env:
BROWSER: ${{ matrix.browser }}
LOCAL: true # run tests locally instead of dev server
TEST_ENV: "node"
28 changes: 26 additions & 2 deletions tests/test/helpers.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,37 @@ if (process.env.BROWSER) {
}

// Check if devel is local or on server
const isLocal = process.env.LOCAL?.toLowerCase() === "true";
const testEnv = process.env.TEST_ENV?.toLowerCase();

// Control debug output to make it easier to see what's going on
const isDebug = process.env.DEBUG?.toLowerCase() === "true";

export const gearBase = isLocal ? "http://localhost:8080" : "https://devel.umgear.org";
// Set the gEAR URL based on the testing environment
const isLocal = testEnv === "local";
const isNode = testEnv === "node";
const isDevel = testEnv === "devel";
let gearBase;
switch (true) {
case isLocal:
console.log("Testing locally");
gearBase = "http://localhost:8080";
break;

case isNode:
console.log("Testing on node");
gearBase = "http://localhost:3000";
break;

case isDevel:
console.log("Testing on devel");
gearBase = "https://devel.umgear.org";
break;

default:
console.error("Unknown testing environment");
throw new Error("Unknown testing environment");
break;
}

export let browser, context;

Expand Down

0 comments on commit c1d2c47

Please sign in to comment.