diff --git a/lib/plugin-loader.js b/lib/plugin-loader.js index 17d84203c..5e54110dd 100644 --- a/lib/plugin-loader.js +++ b/lib/plugin-loader.js @@ -22,7 +22,7 @@ function load_plugins(config, plugin_configs, params, sanity_check) { if (plugin === null && p.match(/^[^\.\/]/)) { plugin = try_load('verdaccio-' + p) // compatibility for old sinopia plugins - if(!plugin) { + if (!plugin) { plugin = try_load('sinopia-' + p) } } @@ -37,18 +37,18 @@ function load_plugins(config, plugin_configs, params, sanity_check) { } if (plugin === null) { - throw Error('"' + p + '" plugin not found\ntry "npm install verdaccio-' + p + '"') + throw new Error('"' + p + '" plugin not found\ntry "npm install verdaccio-' + p + '"') } if (typeof(plugin) !== 'function') - throw Error('"' + p + '" doesn\'t look like a valid plugin') + throw new Error('"' + p + '" doesn\'t look like a valid plugin') plugin = plugin(plugin_configs[p], params) if (plugin === null || !sanity_check(plugin)) - throw Error('"' + p + '" doesn\'t look like a valid plugin') + throw new Error('"' + p + '" doesn\'t look like a valid plugin') - return plugin + return plugin; }) return plugins diff --git a/test/unit/plugin_loader.js b/test/unit/plugin_loader.js index 6c6b3a3a1..4bca68f59 100644 --- a/test/unit/plugin_loader.js +++ b/test/unit/plugin_loader.js @@ -54,6 +54,7 @@ describe('plugin loader', function() { it('testing auth plugin no plugins', function() { let _config = { + self_path: path.join(__dirname, './'), auth: { './unit/partials/test-plugin-storage/invalid-package': {} }