diff --git a/lib/adduser.js b/lib/adduser.js index 4b9fdf1f5f166..b6c3321745667 100644 --- a/lib/adduser.js +++ b/lib/adduser.js @@ -59,6 +59,7 @@ const adduser = async (args) => { log.notice('', `Log in on ${replaceInfo(registry)}`) const { message, newCreds } = await auth({ + ...npm.flatOptions, creds, registry, scope, diff --git a/test/lib/adduser.js b/test/lib/adduser.js index 4e6a56fc199d6..36f59e0857902 100644 --- a/test/lib/adduser.js +++ b/test/lib/adduser.js @@ -9,21 +9,27 @@ const _flatOptions = { authType: 'legacy', registry: 'https://registry.npmjs.org/', scope: '', + fromFlatOptions: true, } let failSave = false let deletedConfig = {} let registryOutput = '' let setConfig = {} -const authDummy = () => Promise.resolve({ - message: 'success', - newCreds: { - username: 'u', - password: 'p', - email: 'u@npmjs.org', - alwaysAuth: false, - }, -}) +const authDummy = (options) => { + if (!options.fromFlatOptions) + throw new Error('did not pass full flatOptions to auth function') + + return Promise.resolve({ + message: 'success', + newCreds: { + username: 'u', + password: 'p', + email: 'u@npmjs.org', + alwaysAuth: false, + }, + }) +} const deleteMock = (key, where) => { deletedConfig = {