Fix plugin version not being loaded

Load the version of the plugin from its package.json file and document
this requirement in the writing plugins document.
This commit is contained in:
Hornwitser committed 2020-10-23 16:57:49 +02:00
1 parent c5a14db8ea
commit 1b0b245484
3 files changed
+23 -9

No files matched your search

+5 -1
View File
@@ -54,6 +54,10 @@ describe("lib/plugin", function() {
path.join(pluginPath, "info.js"),
`module.exports = { name: "${infoName}" };`
);
await fs.outputFile(
path.join(pluginPath, "package.json"),
'{ "version": "0.0.1" }'
);
}
await writePlugin(testPlugin, "test");
@@ -71,7 +75,7 @@ describe("lib/plugin", function() {
it("should load test plugin", async function() {
assert.deepEqual(
await plugin.loadPluginInfos(new Map([["test", path.resolve(testPlugin)]])),
[{ name: "test", requirePath: path.resolve(testPlugin) }]
[{ name: "test", version: "0.0.1", requirePath: path.resolve(testPlugin) }]
);
});
it("should reject on broken plugin", async function() {