From 115cb3fd5d5c2c1ebab762d33f128fbb43d7c1ea Mon Sep 17 00:00:00 2001 From: Hornwitser Date: Tue, 15 Aug 2023 18:15:10 +0200 Subject: [PATCH] Fix path slash issue in plugin loader test On Windows require paths use a mix of forward and backward slashes due to require path possibly being a package path which can't have backward slashes, or a Windows file path which can have have either. Fix plugin loader test failing on Windows due to not using the same combination of forward and backward slashes for require file paths. --- test/lib/plugin_loader.js | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/test/lib/plugin_loader.js b/test/lib/plugin_loader.js index 6e2e1348..5632e17d 100644 --- a/test/lib/plugin_loader.js +++ b/test/lib/plugin_loader.js @@ -79,30 +79,32 @@ describe("lib/plugin_loader", function() { ); }); it("should throw if class is missing from entrypoint", async function() { + const requirePath = path.resolve(missingClass); await assert.rejects( lib.loadControllerPluginClass({ name: "test", controllerEntrypoint: "controller", - requirePath: path.resolve(missingClass), + requirePath, }), { message: - `PluginError: Expected ${path.resolve(missingClass, "controller")} ` + + `PluginError: Expected ${path.posix.join(requirePath, "controller")} ` + "to export a class named ControllerPlugin", } ); }); it("should throw if class is not a subclass of BaseControllerPlugin", async function() { + const requirePath = path.resolve(wrongParentClass); await assert.rejects( lib.loadControllerPluginClass({ name: "test", controllerEntrypoint: "controller", - requirePath: path.resolve(wrongParentClass), + requirePath, }), { message: "PluginError: Expected ControllerPlugin exported from " + - `${path.resolve(wrongParentClass, "controller")} to be a subclass of BaseControllerPlugin`, + `${path.posix.join(requirePath, "controller")} to be a subclass of BaseControllerPlugin`, } ); });