mirror of
https://github.com/clusterio/clusterio.git
synced 2026-11-12 07:04:52 +09:00
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:
1 parent
8bf5296fe6
commit
115cb3fd5d
1 file changed
+6
-4
@@ -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`,
|
||||
}
|
||||
);
|
||||
});
|
||||
|
||||
Reference in new issue
Block a user