From 6f70ccbf8578dfac2dfca517c5495173681172f0 Mon Sep 17 00:00:00 2001 From: bbassie <17990055+bbassie@users.noreply.github.com> Date: Wed, 28 Oct 2026 23:29:50 +0000 Subject: [PATCH] Add a test plugin without a module for the host tests Co-Authored-By: Claude Opus 5.5 --- test/file/test_plugin_no_module/index.js | 8 ++++++++ test/file/test_plugin_no_module/instance.js | 1 + test/file/test_plugin_no_module/package.json | 11 +++++++++++ test/host/create_scenario.js | 2 +- test/host/patch.js | 2 +- 5 files changed, 22 insertions(+), 2 deletions(-) create mode 100644 test/file/test_plugin_no_module/index.js create mode 100644 test/file/test_plugin_no_module/instance.js create mode 100644 test/file/test_plugin_no_module/package.json diff --git a/test/file/test_plugin_no_module/index.js b/test/file/test_plugin_no_module/index.js new file mode 100644 index 00000000..8c5bba47 --- /dev/null +++ b/test/file/test_plugin_no_module/index.js @@ -0,0 +1,8 @@ +// Instance plugin without a module/ folder, for tests that need one. +export const plugin = { + name: "test_plugin_no_module", + title: "Test Plugin Without Module", + description: "Plugin used to test handling of plugins without a module.", + + instanceEntrypoint: "instance.js", +}; diff --git a/test/file/test_plugin_no_module/instance.js b/test/file/test_plugin_no_module/instance.js new file mode 100644 index 00000000..7a39a3e7 --- /dev/null +++ b/test/file/test_plugin_no_module/instance.js @@ -0,0 +1 @@ +export default async function() { } diff --git a/test/file/test_plugin_no_module/package.json b/test/file/test_plugin_no_module/package.json new file mode 100644 index 00000000..851a92e2 --- /dev/null +++ b/test/file/test_plugin_no_module/package.json @@ -0,0 +1,11 @@ +{ + "name": "test_plugin_no_module", + "version": "0.0.1", + "description": "Plugin without a Lua module used by the host tests", + "private": true, + "type": "module", + "main": "index.js", + "keywords": [ + "clusterio-plugin" + ] +} diff --git a/test/host/create_scenario.js b/test/host/create_scenario.js index c3e176dc..00b384cb 100644 --- a/test/host/create_scenario.js +++ b/test/host/create_scenario.js @@ -154,7 +154,7 @@ describe("host/create_scenario", function() { await fs.cp(scenario, freeplay, { recursive: true }); pluginInfos = await lib.loadPluginInfos(new Map([ ["research_sync", path.resolve("plugins/research_sync")], - ["global_chat", path.resolve("plugins/global_chat")], + ["test_plugin_no_module", path.resolve("test/file/test_plugin_no_module")], ])); lib.addPluginConfigFields(pluginInfos); hostConfig = new lib.HostConfig("host", { "host.factorio_directory": factorioDir }); diff --git a/test/host/patch.js b/test/host/patch.js index 838f46ef..7c3e7267 100644 --- a/test/host/patch.js +++ b/test/host/patch.js @@ -241,7 +241,7 @@ describe("host/patch", function() { }); it("should skip plugins without a module", async function() { const pluginInfos = await lib.loadPluginInfos( - new Map([["global_chat", path.resolve("plugins/global_chat")]]) + new Map([["test_plugin_no_module", path.resolve("test/file/test_plugin_no_module")]]) ); const modules = await patch.loadModules(pluginInfos); assert.deepEqual([...modules.keys()], ["clusterio"]);