diff options
author | isaacs <i@izs.me> | 2020-12-18 22:08:48 +0300 |
---|---|---|
committer | isaacs <i@izs.me> | 2020-12-18 22:08:56 +0300 |
commit | 9eef638499c88689acb00d812c10f0407cb95c08 (patch) | |
tree | aaecbf3c929279f2801127974a2e1307c211b13d /test | |
parent | b98569a8ca28dbd611fe84492aee996e2e567b55 (diff) |
Pass full set of options to login helper functions
This fixes 'npm login --no-strict-ssl', as well as a host of other
options that one might want to set while logging in.
Reported by: @toddself
Diffstat (limited to 'test')
-rw-r--r-- | test/lib/adduser.js | 24 |
1 files changed, 15 insertions, 9 deletions
diff --git a/test/lib/adduser.js b/test/lib/adduser.js index 4e6a56fc1..36f59e085 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 = { |