diff --git a/lib/utils/config/definitions.js b/lib/utils/config/definitions.js index b47a46de85e2e..5bd13ac81a479 100644 --- a/lib/utils/config/definitions.js +++ b/lib/utils/config/definitions.js @@ -1782,7 +1782,10 @@ define('scope', { `, flatten (key, obj, flatOptions) { const value = obj[key] - flatOptions.projectScope = value && !/^@/.test(value) ? `@${value}` : value + const scope = value && !/^@/.test(value) ? `@${value}` : value + flatOptions.scope = scope + // projectScope is kept for compatibility with npm-registry-fetch + flatOptions.projectScope = scope }, }) diff --git a/test/lib/utils/config/definitions.js b/test/lib/utils/config/definitions.js index f6813a8bc0bb5..7af0b683987e4 100644 --- a/test/lib/utils/config/definitions.js +++ b/test/lib/utils/config/definitions.js @@ -488,15 +488,15 @@ t.test('maxSockets', t => { t.end() }) -t.test('projectScope', t => { +t.test('scope', t => { const obj = { scope: 'asdf' } const flat = {} definitions.scope.flatten('scope', obj, flat) - t.strictSame(flat, { projectScope: '@asdf' }, 'prepend @ if needed') + t.strictSame(flat, { scope: '@asdf', projectScope: '@asdf' }, 'prepend @ if needed') obj.scope = '@asdf' definitions.scope.flatten('scope', obj, flat) - t.strictSame(flat, { projectScope: '@asdf' }, 'leave untouched if has @') + t.strictSame(flat, { scope: '@asdf', projectScope: '@asdf' }, 'leave untouched if has @') t.end() })