mirror of
https://github.com/verdaccio/verdaccio.git
synced 2025-01-20 22:52:46 -05:00
Fix undefined path value
This commit is contained in:
parent
7df6962f43
commit
580d3e77f7
2 changed files with 6 additions and 5 deletions
|
@ -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
|
||||
|
|
|
@ -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': {}
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue