mirror of
https://github.com/clusterio/clusterio.git
synced 2026-11-18 07:33:12 +09:00
Merge branch 'master' into feature/plugin-install
This commit is contained in:
277 files changed
+2557
-2079
No files matched your search
@@ -1,7 +1,6 @@
|
||||
"use strict";
|
||||
const assert = require("assert").strict;
|
||||
import assert from "node:assert/strict";
|
||||
|
||||
const { ExponentialBackoff } = require("@clusterio/lib");
|
||||
import { ExponentialBackoff } from "@clusterio/lib";
|
||||
|
||||
describe("lib/ExponentialBackoff", function() {
|
||||
describe("class ExponentialBackoff", function() {
|
||||
|
||||
@@ -1,10 +1,9 @@
|
||||
/* eslint-disable node/no-sync */
|
||||
"use strict";
|
||||
const assert = require("assert").strict;
|
||||
const fs = require("node:fs/promises");
|
||||
const path = require("path");
|
||||
import assert from "node:assert/strict";
|
||||
import fs from "node:fs/promises";
|
||||
import path from "node:path";
|
||||
|
||||
const { LockFile } = require("@clusterio/lib");
|
||||
import { LockFile } from "@clusterio/lib";
|
||||
|
||||
const baseDir = path.join("temp", "test", "lock_file");
|
||||
|
||||
|
||||
@@ -1,15 +1,14 @@
|
||||
"use strict";
|
||||
const assert = require("assert").strict;
|
||||
const path = require("path");
|
||||
const fs = require("node:fs/promises");
|
||||
const stream = require("node:stream");
|
||||
const JSZip = require("jszip"); // Added for creating mock zips
|
||||
import assert from "node:assert/strict";
|
||||
import path from "node:path";
|
||||
import fs from "node:fs/promises";
|
||||
import stream from "node:stream";
|
||||
import JSZip from "jszip"; // Added for creating mock zips
|
||||
|
||||
// Capture native fetch before any potential mocks are applied
|
||||
const nativeFetch = global.fetch;
|
||||
|
||||
const { ModStore, ModInfo, ModVersionEquality } = require("@clusterio/lib"); // Adjust path based on compiled output
|
||||
const { externalTest } = require("../integration");
|
||||
import { ModStore, ModInfo, ModVersionEquality } from "@clusterio/lib"; // Adjust path based on compiled output
|
||||
import { externalTest } from "../integration/index.js";
|
||||
|
||||
const MODS_DIR = path.join("temp", "test", "mod_store", "mods");
|
||||
const CACHE_FILE = path.join(MODS_DIR, "mod-info-cache.json");
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
"use strict";
|
||||
const assert = require("assert").strict;
|
||||
import assert from "node:assert/strict";
|
||||
|
||||
const { RateLimiter, wait } = require("@clusterio/lib");
|
||||
import { RateLimiter, wait } from "@clusterio/lib";
|
||||
|
||||
|
||||
describe("lib/RateLimiter", function() {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
const assert = require("assert").strict;
|
||||
const { ValueCache, wait } = require("@clusterio/lib");
|
||||
import assert from "node:assert/strict";
|
||||
import { ValueCache, wait } from "@clusterio/lib";
|
||||
|
||||
describe("ValueCache", function () {
|
||||
describe("constructor", function () {
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
const assert = require("assert").strict;
|
||||
const { checkSingletonImport } = require("@clusterio/lib/dist/node/src/check_singleton_import");
|
||||
import assert from "node:assert/strict";
|
||||
import { checkSingletonImport } from "@clusterio/lib/dist/node/src/check_singleton_import.js";
|
||||
// Import lib so it sets the global indicating lib has been imported.
|
||||
require("@clusterio/lib");
|
||||
import "@clusterio/lib";
|
||||
|
||||
describe("lib/check_singleton_import", function() {
|
||||
it("Should throw an installation error if called twice", function() {
|
||||
assert.throws(
|
||||
() => checkSingletonImport(__filename),
|
||||
() => checkSingletonImport(import.meta.filename),
|
||||
{
|
||||
message: /Attempt to import duplicate copy of @clusterio\/lib/,
|
||||
code: "InstallationError",
|
||||
|
||||
+43
-11
@@ -1,8 +1,7 @@
|
||||
"use strict";
|
||||
const assert = require("assert").strict;
|
||||
import assert from "node:assert/strict";
|
||||
|
||||
const lib = require("@clusterio/lib");
|
||||
const mock = require("../mock");
|
||||
import * as lib from "@clusterio/lib";
|
||||
import * as mock from "../mock.js";
|
||||
|
||||
const addr = lib.Address.fromShorthand;
|
||||
|
||||
@@ -16,39 +15,68 @@ describe("lib/command", function() {
|
||||
let testControl = new mock.MockControl(controlConnector);
|
||||
let testController = new lib.Link(controllerConnector);
|
||||
testController.handle(
|
||||
lib.HostListRequest, () => [new lib.HostDetails("0.1", "Test Host", 11, false)]
|
||||
lib.HostListRequest, () => [
|
||||
new lib.HostDetails("0.1", "Test Host", 11, false),
|
||||
new lib.HostDetails("0.1", "22", 12, false),
|
||||
new lib.HostDetails("0.1", "12", 13, false),
|
||||
]
|
||||
);
|
||||
testController.handle(
|
||||
lib.InstanceDetailsListRequest, () => [new lib.InstanceDetails("Test Instance", 57, 4, undefined, "stopped")]
|
||||
lib.InstanceDetailsListRequest, () => [
|
||||
new lib.InstanceDetails("Test Instance", 57, 4, undefined, "stopped"),
|
||||
new lib.InstanceDetails("10", 58, 4, undefined, "stopped"),
|
||||
new lib.InstanceDetails("58", 59, 4, undefined, "stopped"),
|
||||
]
|
||||
);
|
||||
testController.handle(lib.RoleListRequest, () => [testRole.toJSON()]);
|
||||
let numericRole = lib.Role.fromJSON({ id: 29, name: "77", description: "Test", permissions: [] });
|
||||
testController.handle(lib.RoleListRequest, () => [testRole.toJSON(), numericRole.toJSON()]);
|
||||
|
||||
describe("resolveHost", function() {
|
||||
it("should pass an integer like string back", async function() {
|
||||
assert.equal(await lib.resolveHost(null, "123"), 123);
|
||||
it("should resolve an integer like string as an id", async function() {
|
||||
assert.equal(await lib.resolveHost(testControl, "11"), 11);
|
||||
});
|
||||
it("should resolve a host name with the controller", async function() {
|
||||
assert.equal(await lib.resolveHost(testControl, "Test Host"), 11);
|
||||
});
|
||||
it("should resolve an integer like name if no host has that id", async function() {
|
||||
assert.equal(await lib.resolveHost(testControl, "22"), 12);
|
||||
});
|
||||
it("should prefer the id over an integer like name", async function() {
|
||||
assert.equal(await lib.resolveHost(testControl, "12"), 12);
|
||||
});
|
||||
it("should throw if host is not found", async function() {
|
||||
await assert.rejects(
|
||||
lib.resolveHost(testControl, "invalid"),
|
||||
new lib.CommandError("No host named invalid")
|
||||
);
|
||||
await assert.rejects(
|
||||
lib.resolveHost(testControl, "123"),
|
||||
new lib.CommandError("No host named 123")
|
||||
);
|
||||
});
|
||||
});
|
||||
describe("resolveInstance", function() {
|
||||
it("should pass an integer like string back", async function() {
|
||||
assert.equal(await lib.resolveInstance(null, "123"), 123);
|
||||
it("should resolve an integer like string as an id", async function() {
|
||||
assert.equal(await lib.resolveInstance(testControl, "57"), 57);
|
||||
});
|
||||
it("should resolve an instance name with the controller", async function() {
|
||||
assert.equal(await lib.resolveInstance(testControl, "Test Instance"), 57);
|
||||
});
|
||||
it("should resolve an integer like name if no instance has that id", async function() {
|
||||
assert.equal(await lib.resolveInstance(testControl, "10"), 58);
|
||||
});
|
||||
it("should prefer the id over an integer like name", async function() {
|
||||
assert.equal(await lib.resolveInstance(testControl, "58"), 58);
|
||||
});
|
||||
it("should throw if instance is not found", async function() {
|
||||
await assert.rejects(
|
||||
lib.resolveInstance(testControl, "invalid"),
|
||||
new lib.CommandError("No instance named invalid")
|
||||
);
|
||||
await assert.rejects(
|
||||
lib.resolveInstance(testControl, "123"),
|
||||
new lib.CommandError("No instance named 123")
|
||||
);
|
||||
});
|
||||
});
|
||||
describe("retrieveRole", function() {
|
||||
@@ -58,6 +86,10 @@ describe("lib/command", function() {
|
||||
it("should retrieve a role by name from a string", async function() {
|
||||
assert.deepEqual(await lib.retrieveRole(testControl, "Test Role"), testRole);
|
||||
});
|
||||
it("should retrieve a role by an integer like name if no role has that id", async function() {
|
||||
assert.deepEqual(await lib.retrieveRole(testControl, "28"), testRole);
|
||||
assert.deepEqual(await lib.retrieveRole(testControl, "77"), numericRole);
|
||||
});
|
||||
it("should throw if role is not found", async function() {
|
||||
await assert.rejects(
|
||||
lib.retrieveRole(testControl, "invalid"),
|
||||
|
||||
@@ -1,8 +1,7 @@
|
||||
"use strict";
|
||||
const lib = require("@clusterio/lib");
|
||||
const fs = require("node:fs/promises");
|
||||
const path = require("path");
|
||||
const assert = require("assert").strict;
|
||||
import * as lib from "@clusterio/lib";
|
||||
import fs from "node:fs/promises";
|
||||
import path from "node:path";
|
||||
import assert from "node:assert/strict";
|
||||
const CA = lib.ConfigAccess;
|
||||
|
||||
|
||||
@@ -396,6 +395,15 @@ describe("lib/config/classes", function() {
|
||||
const json = JSON.parse(await fs.readFile(filepath, "utf8"));
|
||||
assert.deepEqual(json, testInstance.toJSON());
|
||||
});
|
||||
it("should not be readable by other users", async function() {
|
||||
if (process.platform === "win32") {
|
||||
this.skip();
|
||||
}
|
||||
const testInstance = new TestConfig("local", { "alpha.foo": "a" }, filepath);
|
||||
testInstance.set("alpha.foo", "b"); // Sets the dirty flag
|
||||
await testInstance.save();
|
||||
assert.equal((await fs.stat(filepath)).mode & 0o777, 0o600);
|
||||
});
|
||||
it("should clear the dirty flag after saving", async function() {
|
||||
const testInstance = new TestConfig("local", { "alpha.foo": "a" }, filepath);
|
||||
testInstance.set("alpha.foo", "b"); // Sets the dirty flag
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
"use strict";
|
||||
const lib = require("@clusterio/lib");
|
||||
const assert = require("assert").strict;
|
||||
import * as lib from "@clusterio/lib";
|
||||
import assert from "node:assert/strict";
|
||||
|
||||
// Each migration test should indicate which version introduced the migration
|
||||
|
||||
|
||||
@@ -1,8 +1,7 @@
|
||||
"use strict";
|
||||
const assert = require("assert").strict;
|
||||
const lib = require("@clusterio/lib");
|
||||
import assert from "node:assert/strict";
|
||||
import * as lib from "@clusterio/lib";
|
||||
const validators = lib.Config.validators;
|
||||
const { ControllerConfig, HostConfig, InstanceConfig, ControlConfig } = lib;
|
||||
import { ControllerConfig, HostConfig, InstanceConfig, ControlConfig } from "@clusterio/lib";
|
||||
|
||||
describe("lib/config/validators", function() {
|
||||
describe("all", function() {
|
||||
|
||||
@@ -1,8 +1,7 @@
|
||||
"use strict";
|
||||
const assert = require("assert").strict;
|
||||
const { HostDetails } = require("@clusterio/lib");
|
||||
import assert from "node:assert/strict";
|
||||
import { HostDetails } from "@clusterio/lib";
|
||||
|
||||
const { testMatrix, testRoundTripJsonSerialisable } = require("../../common");
|
||||
import { testMatrix, testRoundTripJsonSerialisable } from "../../common.js";
|
||||
|
||||
describe("lib/data/HostDetails", function () {
|
||||
|
||||
|
||||
@@ -1,8 +1,7 @@
|
||||
"use strict";
|
||||
const assert = require("assert").strict;
|
||||
const { InstanceDetails } = require("@clusterio/lib");
|
||||
import assert from "node:assert/strict";
|
||||
import { InstanceDetails } from "@clusterio/lib";
|
||||
|
||||
const { testMatrix, testRoundTripJsonSerialisable } = require("../../common");
|
||||
import { testMatrix, testRoundTripJsonSerialisable } from "../../common.js";
|
||||
|
||||
describe("lib/data/InstanceDetails", function () {
|
||||
|
||||
|
||||
@@ -1,13 +1,12 @@
|
||||
"use strict";
|
||||
const assert = require("assert").strict;
|
||||
const fs = require("node:fs/promises");
|
||||
const path = require("path");
|
||||
import assert from "node:assert/strict";
|
||||
import fs from "node:fs/promises";
|
||||
import path from "node:path";
|
||||
|
||||
const lib = require("@clusterio/lib");
|
||||
const libBuildMod = require("@clusterio/lib/build_mod");
|
||||
const { ModInfo, ModDependency } = lib;
|
||||
import * as lib from "@clusterio/lib";
|
||||
import * as libBuildMod from "@clusterio/lib/build_mod.js";
|
||||
import { ModInfo, ModDependency } from "@clusterio/lib";
|
||||
|
||||
const { testMatrix, testRoundTripJsonSerialisable } = require("../../common");
|
||||
import { testMatrix, testRoundTripJsonSerialisable } from "../../common.js";
|
||||
|
||||
describe("lib/data/ModInfo", function() {
|
||||
describe("class ModDependency", function() {
|
||||
|
||||
@@ -1,9 +1,8 @@
|
||||
"use strict";
|
||||
const assert = require("assert").strict;
|
||||
const zlib = require("zlib");
|
||||
import assert from "node:assert/strict";
|
||||
import zlib from "node:zlib";
|
||||
|
||||
const lib = require("@clusterio/lib");
|
||||
const { ModInfo, ModPack, getInstalledModUpdates, applyModRecordAdvisories } = lib;
|
||||
import * as lib from "@clusterio/lib";
|
||||
import { ModInfo, ModPack, getInstalledModUpdates, applyModRecordAdvisories } from "@clusterio/lib";
|
||||
|
||||
|
||||
describe("lib/data/ModPack", function() {
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
"use strict";
|
||||
const assert = require("assert").strict;
|
||||
const lib = require("@clusterio/lib");
|
||||
import assert from "node:assert/strict";
|
||||
import * as lib from "@clusterio/lib";
|
||||
|
||||
describe("lib/data/Role", function() {
|
||||
let defaultPermissions;
|
||||
|
||||
@@ -1,8 +1,6 @@
|
||||
"use strict";
|
||||
const assert = require("assert").strict;
|
||||
import assert from "node:assert/strict";
|
||||
|
||||
const lib = require("@clusterio/lib");
|
||||
const { SystemInfo } = lib;
|
||||
import { SystemInfo } from "@clusterio/lib";
|
||||
|
||||
|
||||
describe("lib/data/SystemInfo", function() {
|
||||
|
||||
@@ -1,8 +1,7 @@
|
||||
"use strict";
|
||||
const assert = require("assert").strict;
|
||||
const { UserDetails, PlayerStats } = require("@clusterio/lib");
|
||||
import assert from "node:assert/strict";
|
||||
import { UserDetails, PlayerStats } from "@clusterio/lib";
|
||||
|
||||
const { testMatrix, testRoundTripJsonSerialisable } = require("../../common");
|
||||
import { testMatrix, testRoundTripJsonSerialisable } from "../../common.js";
|
||||
|
||||
describe("lib/data/UserDetails", function () {
|
||||
it("should be round trip serialisable", function () {
|
||||
|
||||
@@ -1,7 +1,5 @@
|
||||
"use strict";
|
||||
const assert = require("assert").strict;
|
||||
const lib = require("@clusterio/lib");
|
||||
const { Address } = lib;
|
||||
import assert from "node:assert/strict";
|
||||
import { Address } from "@clusterio/lib";
|
||||
|
||||
describe("lib/data/messages_core", function() {
|
||||
describe("class Address", function() {
|
||||
|
||||
@@ -1,8 +1,7 @@
|
||||
"use strict";
|
||||
const assert = require("assert").strict;
|
||||
const lib = require("@clusterio/lib");
|
||||
import assert from "node:assert/strict";
|
||||
import * as lib from "@clusterio/lib";
|
||||
|
||||
const { testMatrix, testRoundTripJsonSerialisable } = require("../../common");
|
||||
import { testMatrix, testRoundTripJsonSerialisable } from "../../common.js";
|
||||
|
||||
describe("lib/data/version", function() {
|
||||
describe("isVersionEquality()", function() {
|
||||
|
||||
@@ -1,9 +1,8 @@
|
||||
"use strict";
|
||||
const assert = require("assert").strict;
|
||||
const fs = require("node:fs/promises");
|
||||
const path = require("path");
|
||||
import assert from "node:assert/strict";
|
||||
import fs from "node:fs/promises";
|
||||
import path from "node:path";
|
||||
|
||||
const lib = require("@clusterio/lib");
|
||||
import * as lib from "@clusterio/lib";
|
||||
|
||||
describe("lib/database", function() {
|
||||
describe("mapToObject()", function() {
|
||||
|
||||
@@ -1,9 +1,8 @@
|
||||
"use strict";
|
||||
const events = require("events");
|
||||
const assert = require("assert").strict;
|
||||
const lib = require("@clusterio/lib");
|
||||
const fs = require("node:fs/promises");
|
||||
const path = require("path");
|
||||
import events from "node:events";
|
||||
import assert from "node:assert/strict";
|
||||
import * as lib from "@clusterio/lib";
|
||||
import fs from "node:fs/promises";
|
||||
import path from "node:path";
|
||||
|
||||
class MockDatastoreProvider extends lib.DatastoreProvider {
|
||||
constructor() {
|
||||
|
||||
+2
-3
@@ -1,7 +1,6 @@
|
||||
"use strict";
|
||||
const assert = require("assert").strict;
|
||||
import assert from "node:assert/strict";
|
||||
|
||||
const lib = require("@clusterio/lib");
|
||||
import * as lib from "@clusterio/lib";
|
||||
|
||||
describe("lib/errors", function() {
|
||||
describe("class InvalidMessage", function() {
|
||||
|
||||
+4
-4
@@ -1,8 +1,8 @@
|
||||
const assert = require("assert").strict;
|
||||
const { readFile } = require("node:fs/promises");
|
||||
import assert from "node:assert/strict";
|
||||
import { readFile } from "node:fs/promises";
|
||||
|
||||
const { fetchFactorioVersions } = require("@clusterio/lib");
|
||||
const { slowTest, externalTest } = require("../../integration");
|
||||
import { fetchFactorioVersions } from "@clusterio/lib";
|
||||
import { slowTest, externalTest } from "../../integration/index.js";
|
||||
|
||||
describe("FactorioVersions", function() {
|
||||
describe("fetchFactorioVersions", function() {
|
||||
|
||||
+3
-3
@@ -1,7 +1,7 @@
|
||||
const assert = require("assert").strict;
|
||||
import assert from "node:assert/strict";
|
||||
|
||||
const { fetchLatestReleases, resolveReleaseChannel } = require("@clusterio/lib");
|
||||
const { slowTest, externalTest } = require("../../integration");
|
||||
import { fetchLatestReleases, resolveReleaseChannel } from "@clusterio/lib";
|
||||
import { slowTest, externalTest } from "../../integration/index.js";
|
||||
|
||||
describe("LatestReleases", function() {
|
||||
describe("fetchLatestReleases", function() {
|
||||
|
||||
@@ -1,11 +1,10 @@
|
||||
"use strict";
|
||||
const assert = require("assert").strict;
|
||||
const zlib = require("zlib");
|
||||
import assert from "node:assert/strict";
|
||||
import zlib from "node:zlib";
|
||||
|
||||
const lib = require("@clusterio/lib");
|
||||
import * as lib from "@clusterio/lib";
|
||||
|
||||
const testStrings = require("./test_strings");
|
||||
const testSettings = require("./test_settings");
|
||||
import * as testStrings from "./test_strings.js";
|
||||
import * as testSettings from "./test_settings.js";
|
||||
|
||||
|
||||
// Simple linear congruential random number generator
|
||||
|
||||
@@ -1,7 +1,5 @@
|
||||
// Lines for testing the factorio output
|
||||
|
||||
"use strict";
|
||||
let testLines = new Map([
|
||||
export const testLines = new Map([
|
||||
[
|
||||
" 1.306 Info RemoteCommandProcessor.cpp:131: Starting RCON interface at port 4000",
|
||||
{
|
||||
@@ -219,7 +217,3 @@ let testLines = new Map([
|
||||
},
|
||||
],
|
||||
]);
|
||||
|
||||
module.exports = {
|
||||
testLines,
|
||||
};
|
||||
@@ -1,6 +1,5 @@
|
||||
"use strict";
|
||||
|
||||
const default_map_gen_settings = {
|
||||
export const default_map_gen_settings = {
|
||||
autoplace_controls: {
|
||||
"coal": { frequency: 1, size: 1, richness: 1 },
|
||||
"copper-ore": { frequency: 1, size: 1, richness: 1 },
|
||||
@@ -37,7 +36,7 @@ const default_map_gen_settings = {
|
||||
water: 1,
|
||||
};
|
||||
|
||||
const default_map_settings = {
|
||||
export const default_map_settings = {
|
||||
pollution: {
|
||||
enabled: true,
|
||||
diffusion_ratio: 0.02,
|
||||
@@ -140,7 +139,7 @@ const default_map_settings = {
|
||||
},
|
||||
};
|
||||
|
||||
const modified_map_gen_settings = {
|
||||
export const modified_map_gen_settings = {
|
||||
autoplace_controls: {
|
||||
"coal": { frequency: 1, size: 1, richness: 1 },
|
||||
"copper-ore": { frequency: 0.5, size: 1, richness: 1 },
|
||||
@@ -196,7 +195,7 @@ const modified_map_gen_settings = {
|
||||
water: 0.3333333432674408,
|
||||
};
|
||||
|
||||
const modified_map_settings = {
|
||||
export const modified_map_settings = {
|
||||
pollution: {
|
||||
enabled: true,
|
||||
diffusion_ratio: 0.02,
|
||||
@@ -299,7 +298,7 @@ const modified_map_settings = {
|
||||
},
|
||||
};
|
||||
|
||||
const modified_v2_map_gen_settings = {
|
||||
export const modified_v2_map_gen_settings = {
|
||||
autoplace_controls: {
|
||||
"coal": { frequency: 1, size: 1, richness: 1 },
|
||||
"copper-ore": { frequency: 0.5, size: 1, richness: 1 },
|
||||
@@ -362,7 +361,7 @@ const modified_v2_map_gen_settings = {
|
||||
territory_settings: null,
|
||||
};
|
||||
|
||||
const modified_v2_map_settings = {
|
||||
export const modified_v2_map_settings = {
|
||||
pollution: {
|
||||
enabled: true,
|
||||
diffusion_ratio: 0.02,
|
||||
@@ -467,7 +466,7 @@ const modified_v2_map_settings = {
|
||||
},
|
||||
};
|
||||
|
||||
const modified_v2_1_map_gen_settings = {
|
||||
export const modified_v2_1_map_gen_settings = {
|
||||
"autoplace_controls": {
|
||||
"coal": { "frequency": 1, "size": 1, "richness": 1 },
|
||||
"copper-ore": { "frequency": 0.5, "size": 1, "richness": 1 },
|
||||
@@ -516,7 +515,7 @@ const modified_v2_1_map_gen_settings = {
|
||||
"territory_settings": null,
|
||||
};
|
||||
|
||||
const modified_v2_1_map_settings = {
|
||||
export const modified_v2_1_map_settings = {
|
||||
"pollution": {
|
||||
"enabled": true,
|
||||
"diffusion_ratio": 0.02,
|
||||
@@ -615,7 +614,7 @@ const modified_v2_1_map_settings = {
|
||||
},
|
||||
};
|
||||
|
||||
const modified_v2_1_13_map_settings = {
|
||||
export const modified_v2_1_13_map_settings = {
|
||||
...modified_v2_1_map_settings,
|
||||
"enemy_expansion": {
|
||||
...modified_v2_1_map_settings.enemy_expansion,
|
||||
@@ -623,7 +622,7 @@ const modified_v2_1_13_map_settings = {
|
||||
},
|
||||
};
|
||||
|
||||
const modified_space_age_map_gen_settings = {
|
||||
export const modified_space_age_map_gen_settings = {
|
||||
autoplace_controls: {
|
||||
"aquilo_crude_oil": { frequency: 1, size: 1, richness: 1 },
|
||||
"calcite": { frequency: 1, size: 1, richness: 1 },
|
||||
@@ -701,16 +700,3 @@ const modified_space_age_map_gen_settings = {
|
||||
no_enemies_mode: false,
|
||||
territory_settings: null,
|
||||
};
|
||||
|
||||
module.exports = {
|
||||
default_map_gen_settings,
|
||||
default_map_settings,
|
||||
modified_map_gen_settings,
|
||||
modified_map_settings,
|
||||
modified_v2_map_gen_settings,
|
||||
modified_v2_map_settings,
|
||||
modified_v2_1_map_gen_settings,
|
||||
modified_v2_1_map_settings,
|
||||
modified_v2_1_13_map_settings,
|
||||
modified_space_age_map_gen_settings,
|
||||
};
|
||||
@@ -1,7 +1,6 @@
|
||||
"use strict";
|
||||
// Exchange strings for testing with
|
||||
|
||||
const default_ = `
|
||||
export default `
|
||||
>>>eNpjZGBkUGQAgwZ7EOZgSc5PzIHxQJgrOb+gILVIN78oFVmYM
|
||||
7moNCVVNz8TVXFqXmpupW5SYjGKYo7Movw8dBNYi0vy81BFSopSU
|
||||
4uRRbhLixLzMktz0fUyMF5imubZ0CLHAML/6xkU/v8HYSDrAdAvI
|
||||
@@ -14,7 +13,7 @@ MPlQMQJEAG2EO4yRgjTod+B0UEeJiuJUALUb8SA7IYUhA9Pwqw9j
|
||||
GQ/mkMwIwLZH2giKg5YooELZGEKnHjBDHcNMDwvsMN4DvMdGJlBD
|
||||
JCqL0AxCA8kAzMKQgs4gIObmQEBgGmjrO/lHgDxa6G4<<<`;
|
||||
|
||||
const modified = `
|
||||
export const modified = `
|
||||
>>>eNp1UzFs00AUvZ8mbRIEypCBSlCCyFAhOQqBKULxlQUxMCCxgnCc
|
||||
S2rh2On5LAgMZOjAgISEurQLXSmCBTGwRWKhEkgIJraiMgBiaGmFOiC
|
||||
FO5/PsUz6pfv+9/6/99+/kwEBOo2k6c83NhrZtOkaNkIDXa286fZ6hG
|
||||
@@ -31,7 +30,7 @@ jnh3gmXQRElVwYyxI8x4FMqOzsu4edrKK6hNZ5wU7V9G+ufEFL+7yHi
|
||||
cySQMp7wDHnRsBW571ORGn6fH2fUDj/FwV0iUbXPMbmTP7akkt8ChiL
|
||||
/BPceEs3j1M3iz71/ObT9tA==<<<`;
|
||||
|
||||
const modified_v2 = `
|
||||
export const modified_v2 = `
|
||||
>>>eNp1Uz9oU0EY/y5N2iRWzRCFitSAGURIjNEpSN7VRRwcBFeJl5dL
|
||||
+ujLe+3de9XoYIYODoogXdrFrlZ0EQe3gIsFBdHJrVIHBYdWi3QQ4l3
|
||||
u3csz1Q++7333+31/75IYAJwRCpNx0yU2QNfQmjbd+XnKCi6jgg/hlM
|
||||
@@ -49,7 +48,7 @@ Ln6IET6h2alhiMgvQ3SGxnDDDd32daT/yCD5fQ8R3WMEyeN/PENaNmy
|
||||
E5utYOI24z/cT+oQf48FdgozaFZg6qX+1KqW+GYyy4qNZgFNY/0IAHj
|
||||
RI5Q/27QvL<<<`;
|
||||
|
||||
const modified_v2_1 = `
|
||||
export const modified_v2_1 = `
|
||||
>>>eNp1U89rE0EUftM0NYlVc4iCIjWHHkRICNFTkezoRTx4ELxKnGwm
|
||||
unSz087uVlsP5uDBg1CQXvSiVyt6EY9CwIu9if4DlXqwt1aK9CDEeZm
|
||||
dyZrgg/f49nu/37BTQCAPGYDZaVcwH6DnGC24YmmJy4qQHAAsnXdl3O
|
||||
@@ -65,7 +64,7 @@ JYkZplFakZG9jCkjt5gyQ4nHFv3qqTPmsjWiYeiVKOkP57RB9xB0Dvk
|
||||
X9skPmJ46b3GGNscC4FCtiwbc3PTPrUX46YL/qSDp8BMOqAJI8C+u/S
|
||||
peyl8e7GC3Ce2le3AIs019Y//gU3lOV1<<<`;
|
||||
|
||||
const modified_space_age = `
|
||||
export const modified_space_age = `
|
||||
>>>eNp1VEFoE0EUnUkb27TWBomFSqkBexAhMVZPRbJbL+LBg+BV1slm
|
||||
kgzd7LYzs9HYgz304EEQpJf2Yq9W9CIevBW8WFAQPXmr1IOCh1aL9CD
|
||||
UmZ2dzW4aB2by972Z9//7MyQFALggJpjIogWfOJ5lU7+KLY84ACwZeg
|
||||
@@ -86,7 +85,7 @@ Gx0+5gy4RUpPimXd3JJg0hSVAZVaD42oXlGs+OdLeL8NIjXUO043NJp
|
||||
38bydxUydeQi4j66kCmzxzUMyYTVaPneF1Uj+vlxQH+ZT82gl0Du2he
|
||||
Y+lJ/JEpK/WZNmBM/mgXgnKlfCACLzljjH+s/hYo=<<<`;
|
||||
|
||||
const modified_v2_1_13 = `
|
||||
export const modified_v2_1_13 = `
|
||||
>>>eNp1U89rE0EUftMmNYm15hAFRWoOPYiQEKKgFMmOXsSDB0HwJHGy
|
||||
mejSzU47u1utHszBgwdBkF70olcrehHvAS/2JvUfqNSDvbVSpAehzsv
|
||||
sTNYEH7zHt9/7/YadAAIzSmE64wrmA/QcowVXLC5yWRGSA4Cl866M27
|
||||
@@ -101,12 +100,3 @@ JYkZpmFakZGd1AkjtxhSQjYziizPKvHmmTPmUDWuYoiVKOgP57RB9yS
|
||||
0Dvo1NMEfJJWw1i+YLmuywM1C1jwbPKaGnjffEMETl1yE9Qxu/9C7rp
|
||||
u3nVP+RQebGLpzeY4SxwbkUKGDDtjU/J9P3/nrIfNHXdPAWgFF7JHkZ
|
||||
0L+YLmXPjcc3XoAz1D69BVjk1sULxb83nuUA<<<`;
|
||||
|
||||
module.exports = {
|
||||
default: default_,
|
||||
modified,
|
||||
modified_v2,
|
||||
modified_v2_1,
|
||||
modified_v2_1_13,
|
||||
modified_space_age,
|
||||
};
|
||||
+16
-7
@@ -1,11 +1,10 @@
|
||||
"use strict";
|
||||
const assert = require("assert").strict;
|
||||
const fs = require("node:fs/promises");
|
||||
const http = require("node:http");
|
||||
const path = require("path");
|
||||
const util = require("node:util");
|
||||
import assert from "node:assert/strict";
|
||||
import fs from "node:fs/promises";
|
||||
import http from "node:http";
|
||||
import path from "node:path";
|
||||
import util from "node:util";
|
||||
|
||||
const lib = require("@clusterio/lib");
|
||||
import * as lib from "@clusterio/lib";
|
||||
|
||||
describe("lib/file_ops", function() {
|
||||
let baseDir = path.join("temp", "test", "file_ops");
|
||||
@@ -101,6 +100,16 @@ describe("lib/file_ops", function() {
|
||||
await assert.rejects(fs.access(target.replace(".txt", ".tmp.txt")), "temporary was left behind");
|
||||
assert.equal(await fs.readFile(target, "utf8"), "current");
|
||||
});
|
||||
it("should apply mode to a leftover temporary file", async function() {
|
||||
if (process.platform === "win32") {
|
||||
this.skip();
|
||||
}
|
||||
let target = path.join(baseDir, "safe", "mode.txt");
|
||||
await fs.writeFile(target.replace(".txt", ".tmp.txt"), "stale", { mode: 0o644 });
|
||||
await lib.safeOutputFile(target, "private", { mode: 0o600 });
|
||||
assert.equal((await fs.stat(target)).mode & 0o777, 0o600);
|
||||
assert.equal(await fs.readFile(target, "utf8"), "private");
|
||||
});
|
||||
it("should handle creating file in current working directory", async function() {
|
||||
let target = "temporary-file-made-to-test-cwd.txt";
|
||||
try {
|
||||
|
||||
+4
-5
@@ -1,9 +1,8 @@
|
||||
"use strict";
|
||||
const assert = require("assert").strict;
|
||||
const fs = require("node:fs/promises");
|
||||
const path = require("path");
|
||||
import assert from "node:assert/strict";
|
||||
import fs from "node:fs/promises";
|
||||
import path from "node:path";
|
||||
|
||||
const lib = require("@clusterio/lib");
|
||||
import * as lib from "@clusterio/lib";
|
||||
|
||||
|
||||
describe("lib/hash", function() {
|
||||
|
||||
+2
-3
@@ -1,8 +1,7 @@
|
||||
"use strict";
|
||||
const assert = require("assert").strict;
|
||||
import assert from "node:assert/strict";
|
||||
const hrtime = process.hrtime.bigint;
|
||||
|
||||
const lib = require("@clusterio/lib");
|
||||
import * as lib from "@clusterio/lib";
|
||||
|
||||
|
||||
describe("lib/helpers", function() {
|
||||
|
||||
+3
-4
@@ -1,7 +1,6 @@
|
||||
"use strict";
|
||||
const assert = require("assert").strict;
|
||||
const fs = require("node:fs/promises");
|
||||
const lib = require("@clusterio/lib");
|
||||
import assert from "node:assert/strict";
|
||||
import fs from "node:fs/promises";
|
||||
import * as lib from "@clusterio/lib";
|
||||
|
||||
describe("lib/ini", function() {
|
||||
describe("parse()", function() {
|
||||
|
||||
@@ -1,9 +1,8 @@
|
||||
"use strict";
|
||||
const assert = require("assert").strict;
|
||||
const events = require("events");
|
||||
import assert from "node:assert/strict";
|
||||
import events from "node:events";
|
||||
|
||||
const mock = require("../../mock");
|
||||
const lib = require("@clusterio/lib");
|
||||
import * as mock from "../../mock.js";
|
||||
import * as lib from "@clusterio/lib";
|
||||
|
||||
|
||||
describe("lib/link/connectors", function() {
|
||||
|
||||
@@ -1,9 +1,8 @@
|
||||
"use strict";
|
||||
const assert = require("assert").strict;
|
||||
const events = require("events");
|
||||
import assert from "node:assert/strict";
|
||||
import events from "node:events";
|
||||
|
||||
const lib = require("@clusterio/lib");
|
||||
const mock = require("../../mock");
|
||||
import * as lib from "@clusterio/lib";
|
||||
import * as mock from "../../mock.js";
|
||||
|
||||
const addr = lib.Address.fromShorthand;
|
||||
|
||||
|
||||
@@ -1,10 +1,9 @@
|
||||
"use strict";
|
||||
const assert = require("assert").strict;
|
||||
const fs = require("node:fs/promises");
|
||||
const path = require("path");
|
||||
import assert from "node:assert/strict";
|
||||
import fs from "node:fs/promises";
|
||||
import path from "node:path";
|
||||
|
||||
const { testLines } = require("./factorio/lines");
|
||||
const lib = require("@clusterio/lib");
|
||||
import { testLines } from "./factorio/lines.js";
|
||||
import * as lib from "@clusterio/lib";
|
||||
|
||||
|
||||
describe("lib/logging_utils.js", function() {
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
"use strict";
|
||||
const assert = require("assert").strict;
|
||||
import assert from "node:assert/strict";
|
||||
|
||||
const lib = require("@clusterio/lib");
|
||||
import * as lib from "@clusterio/lib";
|
||||
|
||||
|
||||
describe("lib/lua_tools", function() {
|
||||
|
||||
+23
-4
@@ -1,11 +1,30 @@
|
||||
"use strict";
|
||||
const assert = require("assert").strict;
|
||||
import assert from "node:assert/strict";
|
||||
|
||||
const mock = require("../mock");
|
||||
const lib = require("@clusterio/lib");
|
||||
import * as mock from "../mock.js";
|
||||
import * as lib from "@clusterio/lib";
|
||||
|
||||
|
||||
describe("lib/plugin", function() {
|
||||
describe("pluginNeedsWebBuild()", function() {
|
||||
it("should be false for plugins with only host, instance or ctl code", function() {
|
||||
assert.equal(lib.pluginNeedsWebBuild({ name: "foo", title: "Foo" }), false);
|
||||
assert.equal(lib.pluginNeedsWebBuild({
|
||||
name: "foo", title: "Foo", hostEntrypoint: "host.js", instanceEntrypoint: "instance.js",
|
||||
ctlEntrypoint: "ctl.js", messages: [],
|
||||
}), false);
|
||||
});
|
||||
it("should be true for plugins with web or controller code or config fields", function() {
|
||||
assert.equal(lib.pluginNeedsWebBuild({ name: "foo", title: "Foo", webEntrypoint: "web.js" }), true);
|
||||
assert.equal(lib.pluginNeedsWebBuild({
|
||||
name: "foo", title: "Foo", controllerEntrypoint: "controller.js",
|
||||
}), true);
|
||||
for (const field of [
|
||||
"controllerConfigFields", "hostConfigFields", "instanceConfigFields", "controlConfigFields",
|
||||
]) {
|
||||
assert.equal(lib.pluginNeedsWebBuild({ name: "foo", title: "Foo", [field]: {} }), true, field);
|
||||
}
|
||||
});
|
||||
});
|
||||
describe("invokeHook()", function() {
|
||||
let betaTestCalled = false;
|
||||
let plugins = new Map([
|
||||
|
||||
+16
-15
@@ -1,10 +1,10 @@
|
||||
"use strict";
|
||||
const assert = require("assert").strict;
|
||||
const fs = require("node:fs/promises");
|
||||
const path = require("path");
|
||||
import assert from "node:assert/strict";
|
||||
import fs from "node:fs/promises";
|
||||
import path from "node:path";
|
||||
import { pathToFileURL } from "node:url";
|
||||
|
||||
const lib = require("@clusterio/lib");
|
||||
const { BaseControllerPlugin } = require("@clusterio/controller");
|
||||
import * as lib from "@clusterio/lib";
|
||||
import { BaseControllerPlugin } from "@clusterio/controller";
|
||||
|
||||
|
||||
describe("lib/plugin_loader", function() {
|
||||
@@ -19,7 +19,7 @@ describe("lib/plugin_loader", function() {
|
||||
await fs.mkdir(pluginPath, { recursive: true });
|
||||
await fs.writeFile(
|
||||
path.join(pluginPath, "index.js"),
|
||||
`module.exports.plugin = { name: "${infoName}" };`
|
||||
`export const plugin = { name: "${infoName}" };`
|
||||
);
|
||||
await fs.writeFile(
|
||||
path.join(pluginPath, "package.json"),
|
||||
@@ -47,6 +47,7 @@ describe("lib/plugin_loader", function() {
|
||||
name: "test",
|
||||
version: "0.0.1",
|
||||
npmPackage: undefined,
|
||||
packagePath: path.resolve(path.join(testPlugin, "package.json")),
|
||||
requirePath: path.resolve(testPlugin),
|
||||
webStaticPath: path.resolve(path.join(testPlugin, "dist", "web", "static")),
|
||||
}]
|
||||
@@ -55,7 +56,7 @@ describe("lib/plugin_loader", function() {
|
||||
it("should reject on broken plugin", async function() {
|
||||
let brokenMessage;
|
||||
try {
|
||||
require(path.resolve(brokenPlugin));
|
||||
await import(pathToFileURL(path.resolve(path.join(brokenPlugin, "index.js"))));
|
||||
} catch (err) {
|
||||
brokenMessage = err.message;
|
||||
}
|
||||
@@ -83,7 +84,7 @@ describe("lib/plugin_loader", function() {
|
||||
|
||||
await writeEntrypoint(missingClass, "");
|
||||
await writeEntrypoint(
|
||||
wrongParentClass, "class ControllerPlugin {}\n module.exports = { ControllerPlugin };\n"
|
||||
wrongParentClass, "export class ControllerPlugin {};\n"
|
||||
);
|
||||
});
|
||||
it("should throw if class is missing from entrypoint", async function() {
|
||||
@@ -91,13 +92,13 @@ describe("lib/plugin_loader", function() {
|
||||
await assert.rejects(
|
||||
lib.loadPluginClass(
|
||||
"test",
|
||||
path.posix.join(requirePath, "controller"),
|
||||
path.posix.join(requirePath, "controller.js"),
|
||||
"ControllerPlugin",
|
||||
BaseControllerPlugin,
|
||||
),
|
||||
{
|
||||
message:
|
||||
`PluginError: Expected ${path.posix.join(requirePath, "controller")} ` +
|
||||
`PluginError: Expected ${path.posix.join(requirePath, "controller.js")} ` +
|
||||
"to export a class named ControllerPlugin",
|
||||
}
|
||||
);
|
||||
@@ -107,14 +108,14 @@ describe("lib/plugin_loader", function() {
|
||||
await assert.rejects(
|
||||
lib.loadPluginClass(
|
||||
"test",
|
||||
path.posix.join(requirePath, "controller"),
|
||||
path.posix.join(requirePath, "controller.js"),
|
||||
"ControllerPlugin",
|
||||
BaseControllerPlugin,
|
||||
),
|
||||
{
|
||||
message:
|
||||
"PluginError: Expected ControllerPlugin exported from " +
|
||||
`${path.posix.join(requirePath, "controller")} to be a subclass of BaseControllerPlugin`,
|
||||
`${path.posix.join(requirePath, "controller.js")} to be a subclass of BaseControllerPlugin`,
|
||||
}
|
||||
);
|
||||
});
|
||||
@@ -151,7 +152,7 @@ describe("lib/plugin_loader", function() {
|
||||
await fs.mkdir(pluginPath, { recursive: true });
|
||||
await fs.writeFile(
|
||||
path.join(pluginPath, "index.js"),
|
||||
`module.exports.plugin = { name: "${name}" };`
|
||||
`export const plugin = { name: "${name}" };`
|
||||
);
|
||||
await fs.writeFile(
|
||||
path.join(pluginPath, "package.json"),
|
||||
@@ -194,7 +195,7 @@ describe("lib/plugin_loader", function() {
|
||||
await fs.mkdir(path.join(deepPluginPath, "dist"));
|
||||
await fs.writeFile(
|
||||
path.join(deepPluginPath, "dist", "index.js"),
|
||||
'module.exports.plugin = { name: "deep" };'
|
||||
'export const plugin = { name: "deep" };'
|
||||
);
|
||||
|
||||
// Create an npm module that is not a plugin
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
"use strict";
|
||||
const assert = require("assert").strict;
|
||||
import assert from "node:assert/strict";
|
||||
|
||||
const prometheus = require("@clusterio/lib");
|
||||
import * as prometheus from "@clusterio/lib";
|
||||
|
||||
|
||||
describe("lib/prometheus", function() {
|
||||
|
||||
+16
-3
@@ -1,6 +1,5 @@
|
||||
"use strict";
|
||||
const assert = require("assert").strict;
|
||||
const lib = require("@clusterio/lib");
|
||||
import assert from "node:assert/strict";
|
||||
import * as lib from "@clusterio/lib";
|
||||
|
||||
describe("rce_ops", function() {
|
||||
describe("updatePackage", function() {
|
||||
@@ -29,6 +28,20 @@ describe("rce_ops", function() {
|
||||
});
|
||||
});
|
||||
|
||||
describe("handleUpdateAll", function() {
|
||||
it("updates the core package and all npm plugins in one command", async function() {
|
||||
const _audit = lib.logger.audit;
|
||||
const messages = [];
|
||||
lib.logger.audit = (msg) => { messages.push(msg); };
|
||||
try {
|
||||
await lib.handleUpdateAll("core", [{ npmPackage: "foo" }, { name: "local" }, { npmPackage: "bar" }]);
|
||||
} finally {
|
||||
lib.logger.audit = _audit;
|
||||
}
|
||||
assert.deepEqual(messages, ["RCE | npm update --save core foo bar"]);
|
||||
});
|
||||
});
|
||||
|
||||
describe("handlePluginInstall", function() {
|
||||
const _fetch = global.fetch;
|
||||
before(function() {
|
||||
|
||||
+6
-7
@@ -1,11 +1,10 @@
|
||||
"use strict";
|
||||
const assert = require("assert").strict;
|
||||
const fs = require("node:fs/promises");
|
||||
const path = require("path");
|
||||
const stream = require("stream");
|
||||
const util = require("util");
|
||||
import assert from "node:assert/strict";
|
||||
import fs from "node:fs/promises";
|
||||
import path from "node:path";
|
||||
import stream from "node:stream";
|
||||
import util from "node:util";
|
||||
|
||||
const lib = require("@clusterio/lib");
|
||||
import * as lib from "@clusterio/lib";
|
||||
|
||||
const finished = util.promisify(stream.finished);
|
||||
|
||||
|
||||
@@ -1,9 +1,8 @@
|
||||
"use strict";
|
||||
const events = require("events");
|
||||
const assert = require("assert").strict;
|
||||
const lib = require("@clusterio/lib");
|
||||
const { MockController, MockConnector, MockControl } = require("../mock");
|
||||
const { testMatrix, testRoundTripJsonSerialisable } = require("../common");
|
||||
import events from "node:events";
|
||||
import assert from "node:assert/strict";
|
||||
import * as lib from "@clusterio/lib";
|
||||
import { MockController, MockConnector, MockControl } from "../mock.js";
|
||||
import { testMatrix, testRoundTripJsonSerialisable } from "../common.js";
|
||||
|
||||
const addr = lib.Address.fromShorthand;
|
||||
|
||||
|
||||
+43
-3
@@ -1,6 +1,5 @@
|
||||
"use strict";
|
||||
const assert = require("assert").strict;
|
||||
const lib = require("@clusterio/lib");
|
||||
import assert from "node:assert/strict";
|
||||
import * as lib from "@clusterio/lib";
|
||||
|
||||
|
||||
describe("lib/users", function() {
|
||||
@@ -44,4 +43,45 @@ describe("lib/users", function() {
|
||||
);
|
||||
});
|
||||
});
|
||||
|
||||
describe("registerPluginPermissions()", function() {
|
||||
it("should define the permissions declared by plugins", function() {
|
||||
lib.registerPluginPermissions([
|
||||
{ name: "foo", permissions: [
|
||||
{ name: "foo.first", title: "First", description: "The first" },
|
||||
{ name: "foo.second", title: "Second", description: "The second", grantByDefault: true },
|
||||
]},
|
||||
{ name: "bar" },
|
||||
{ name: "baz", permissions: [] },
|
||||
]);
|
||||
assert(lib.permissions.has("foo.first"), "foo.first was not defined");
|
||||
assert.equal(lib.permissions.get("foo.first").grantByDefault, false);
|
||||
assert(lib.permissions.has("foo.second"), "foo.second was not defined");
|
||||
assert.equal(lib.permissions.get("foo.second").grantByDefault, true);
|
||||
});
|
||||
|
||||
it("should throw if the name does not start with the plugin name", function() {
|
||||
assert.throws(
|
||||
() => lib.registerPluginPermissions([
|
||||
{ name: "foo", permissions: [{ name: "bar.spam", title: "Spam", description: "Spam" }] },
|
||||
]),
|
||||
new Error("Expected name of permission 'bar.spam' for foo to start with 'foo.'")
|
||||
);
|
||||
assert.throws(
|
||||
() => lib.registerPluginPermissions([
|
||||
{ name: "foo", permissions: [{ title: "Spam", description: "Spam" }] },
|
||||
]),
|
||||
new Error("Expected name of permission 'undefined' for foo to start with 'foo.'")
|
||||
);
|
||||
});
|
||||
|
||||
it("should throw on already defined permission", function() {
|
||||
assert.throws(
|
||||
() => lib.registerPluginPermissions([
|
||||
{ name: "foo", permissions: [{ name: "foo.first", title: "First", description: "The first" }] },
|
||||
]),
|
||||
new Error("Permission 'foo.first' is already defined")
|
||||
);
|
||||
});
|
||||
});
|
||||
});
|
||||
+3
-4
@@ -1,8 +1,7 @@
|
||||
"use strict";
|
||||
const assert = require("assert").strict;
|
||||
const JSZip = require("jszip");
|
||||
import assert from "node:assert/strict";
|
||||
import JSZip from "jszip";
|
||||
|
||||
const { findRoot } = require("@clusterio/lib");
|
||||
import { findRoot } from "@clusterio/lib";
|
||||
|
||||
|
||||
describe("lib/factorio", function() {
|
||||
|
||||
Reference in new issue
Block a user