diff --git a/desktop/plugin-lib/src/__tests__/pluginInstaller.node.ts b/desktop/plugin-lib/src/__tests__/pluginInstaller.node.ts index 5d239dacf..59fd8b50b 100644 --- a/desktop/plugin-lib/src/__tests__/pluginInstaller.node.ts +++ b/desktop/plugin-lib/src/__tests__/pluginInstaller.node.ts @@ -147,6 +147,12 @@ describe('pluginInstaller', () => { ]); }); + test('getInstalledPlugins when no plugins installed', async () => { + await fs.remove(pluginInstallationDir); + const plugins = await getInstalledPlugins(); + expect(plugins).toHaveLength(0); + }); + test('moveInstalledPluginsFromLegacyDir', async () => { await moveInstalledPluginsFromLegacyDir(); expect( diff --git a/desktop/plugin-lib/src/pluginInstaller.ts b/desktop/plugin-lib/src/pluginInstaller.ts index 11ce2ec95..e3a214c46 100644 --- a/desktop/plugin-lib/src/pluginInstaller.ts +++ b/desktop/plugin-lib/src/pluginInstaller.ts @@ -215,6 +215,9 @@ type InstalledPluginVersionDirs = [string, string[]][]; async function getInstalledPluginVersionDirs(): Promise< InstalledPluginVersionDirs > { + if (!(await fs.pathExists(pluginInstallationDir))) { + return []; + } return await fs .readdir(pluginInstallationDir) .then((dirs) => dirs.map((dir) => path.join(pluginInstallationDir, dir)))