Merge remote-tracking branch 'upstream/master' into feature/wait-for-plugin

This commit is contained in:
bbassie committed 2026-11-20 21:13:53 +00:00
commit 7f688d2ed0
77 files changed
+2006 -693

No files matched your search

+43
View File
@@ -336,6 +336,49 @@ describe("class Instance", function() {
});
});
describe(".checkRequiredMods()", function() {
beforeEach(function() {
instance.loadedPlugins = new Set([
{ name: "foo", requiredMods: ["foo_mod", "bar_mod >= 1.1.0", "bar_mod < 2.0.0"] },
{ name: "bar" },
]);
});
function modPack(mods) {
return lib.ModPack.fromJSON({ name: "pack", mods });
}
it("should accept a mod pack with the required mods", function() {
instance.checkRequiredMods(modPack([
{ name: "foo_mod", enabled: true, version: "1.0.0" },
{ name: "bar_mod", enabled: true, version: "1.1.0" },
]));
});
it("should reject missing, disabled and out of range mods", function() {
const expected = (unmet) => new lib.ConflictError(
"Mod pack pack does not have the mods required by the loaded plugins. " +
`Plugin foo requires ${unmet}. ` +
"Add the mods to the mod pack or set <plugin>.load_plugin to false for this instance."
);
assert.throws(
() => instance.checkRequiredMods(modPack([{ name: "bar_mod", enabled: true, version: "1.0.0" }])),
expected("foo_mod (missing), bar_mod >= 1.1.0 (found 1.0.0)"),
);
assert.throws(
() => instance.checkRequiredMods(modPack([
{ name: "foo_mod", enabled: false, version: "1.0.0" },
{ name: "bar_mod", enabled: true, version: "2.0.0" },
])),
expected("foo_mod (disabled), bar_mod < 2.0.0 (found 2.0.0)"),
);
});
it("should ignore plugins that are not loaded", function() {
instance.loadedPlugins = new Set([{ name: "bar" }]);
instance.checkRequiredMods(modPack([]));
});
});
describe("save name checks", function() {
it("should reject a start save outside the saves directory", async function() {
await assert.rejects(