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.
This commit is contained in:
Hornwitser committed 2023-08-15 18:44:53 +02:00
1 parent 8bf5296fe6
commit 115cb3fd5d
1 file changed
+6 -4
+6 -4
View File
@@ -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`,
}
);
});