Source factorio dir from config-host.json in tests

If a factorio dir is configured in config-host.json then use that in the
tests.  This removes the requirement of having a factorio installation
in ./factorio or linking to one there when running the tests.
This commit is contained in:
Hornwitser committed 2024-09-03 21:58:45 +02:00
1 parent f3150a9261
commit 5d97e8e816
3 files changed
+30 -5

No files matched your search

+3 -3
View File
@@ -8,13 +8,13 @@ const lib = require("@clusterio/lib");
const { FactorioServer, _getVersion } = require("@clusterio/host/dist/node/src/server");
const { logger } = lib;
const { slowTest } = require("./index");
const { slowTest, factorioDir } = require("./index");
describe("Integration of host/src/server", function() {
describe("_getVersion()", function() {
it("should get a version from factorio's changelog.txt", async function() {
let version = await _getVersion(path.join("factorio", "data", "changelog.txt"));
let version = await _getVersion(path.join(factorioDir, "data", "changelog.txt"));
if (!/^\d+\.\d+\.\d+$/.test(version)) {
assert.fail(`Detected version '${version}' does not followed the format x.y.z`);
}
@@ -23,7 +23,7 @@ describe("Integration of host/src/server", function() {
describe("class FactorioServer", function() {
let writePath = path.join("temp", "test", "integration");
let server = new FactorioServer("factorio", writePath, {});
let server = new FactorioServer(factorioDir, writePath, {});
let logFile;
before(async function() {