From 17133dc1f52bf27e5026eb0cac56eeeffef79fc7 Mon Sep 17 00:00:00 2001 From: Danielv123 Date: Fri, 29 Nov 2024 20:08:13 +0000 Subject: [PATCH] Test for compatability with missing dependencies field in package.json --- test/lib/plugin_loader.js | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/test/lib/plugin_loader.js b/test/lib/plugin_loader.js index 0173e85a..fd5126bb 100644 --- a/test/lib/plugin_loader.js +++ b/test/lib/plugin_loader.js @@ -198,6 +198,22 @@ describe("lib/plugin_loader", function() { assert.strictEqual(pluginList.get("monorepo-plugin"), monorepoPluginPathAbs); }); + it("should not throw when package.json has no dependencies field", async function() { + // Create a package.json without dependencies + await fs.outputFile( + path.join("package.json"), + JSON.stringify({ + name: "test-package", + version: "1.0.0", + }) + ); + + // Should not throw + await assert.doesNotReject(async () => { + await lib.loadPluginList(pluginListPath, true); + }); + }); + after(async function() { process.chdir(old_cwd); await fs.remove(baseDir);