diff --git a/.github/workflows/mocha_tests.yml b/.github/workflows/mocha_tests.yml index 1d5c1571..fbb8944b 100644 --- a/.github/workflows/mocha_tests.yml +++ b/.github/workflows/mocha_tests.yml @@ -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 \ No newline at end of file + TEST_ENV: "node" \ No newline at end of file diff --git a/tests/test/helpers.js b/tests/test/helpers.js index d3f9eac8..3b80f6c4 100644 --- a/tests/test/helpers.js +++ b/tests/test/helpers.js @@ -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;