mirror of
https://github.com/clusterio/clusterio.git
synced 2026-11-22 08:13:12 +09:00
Support nested factorio dirs in server test
Source the factorio directory from the host config as with other tests and handle it pointing to a folder of Factorio installations.
This commit is contained in:
1 parent
64cc9c2b64
commit
36fc2ac1db
1 file changed
+18
-2
@@ -14,9 +14,25 @@ const { slowTest, factorioDir } = require("./index");
|
|||||||
describe("Integration of host/src/server", function() {
|
describe("Integration of host/src/server", function() {
|
||||||
describe("_getVersion()", function() {
|
describe("_getVersion()", function() {
|
||||||
it("should get a version from factorio's changelog.txt", async function() {
|
it("should get a version from factorio's changelog.txt", async function() {
|
||||||
|
function checkVersion(version) {
|
||||||
|
if (!/^\d+\.\d+\.\d+$/.test(version)) {
|
||||||
|
assert.fail(`Detected version '${version}' does not followed the format x.y.z`);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
let version = await _getVersion(path.join(factorioDir, "data", "changelog.txt"));
|
let version = await _getVersion(path.join(factorioDir, "data", "changelog.txt"));
|
||||||
if (!/^\d+\.\d+\.\d+$/.test(version)) {
|
if (version !== null) {
|
||||||
assert.fail(`Detected version '${version}' does not followed the format x.y.z`);
|
checkVersion(version);
|
||||||
|
} else {
|
||||||
|
for (let entry of await fs.readdir(factorioDir, { withFileTypes: true })) {
|
||||||
|
if (!entry.isDirectory()) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
checkVersion(
|
||||||
|
await _getVersion(path.join(factorioDir, entry.name, "data", "changelog.txt"))
|
||||||
|
);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in new issue
Block a user