diff options
author | Luke Karrys <luke@lukekarrys.com> | 2022-04-11 22:25:06 +0300 |
---|---|---|
committer | Nathan Fritz <fritzy@github.com> | 2022-04-14 00:30:39 +0300 |
commit | e992b4a21ecdd96aa33c59682c0ac0cc8a30d776 (patch) | |
tree | d800e3773133182ca97599989aa4083f65d113be | |
parent | 25450652240dc8e7e28e391313b93f0f27c6da19 (diff) |
fixup! fix: show more information during publish dry-run
-rw-r--r-- | test/lib/commands/publish.js | 28 |
1 files changed, 18 insertions, 10 deletions
diff --git a/test/lib/commands/publish.js b/test/lib/commands/publish.js index e266ea524..64eb7c60c 100644 --- a/test/lib/commands/publish.js +++ b/test/lib/commands/publish.js @@ -227,6 +227,18 @@ t.test( ), }) + const npm = mockNpm({ + config: { 'dry-run': true, loglevel: 'info' }, + output: () => { + t.pass('output fn is called') + }, + }, t) + const registry = npm.config.get('registry') + npm.config.getCredentialsByURI = uri => { + t.same(uri, registry, 'gets credentials for expected registry') + return { /* no token will call log.warn */ } + } + const Publish = t.mock('../../../lib/commands/publish.js', { '../../../lib/utils/tar.js': { getContents: () => ({ @@ -235,6 +247,12 @@ t.test( logTar: () => { t.pass('logTar is called') }, + 'proc-log': { + warn (_, msg) { + t.match(msg, + `This command requires you to be logged in to ${registry} (dry-run)`) + }, + }, }, libnpmpublish: { publish: () => { @@ -242,16 +260,6 @@ t.test( }, }, }) - const npm = mockNpm({ - config: { 'dry-run': true, loglevel: 'info' }, - output: () => { - t.pass('output fn is called') - }, - }, t) - npm.config.getCredentialsByURI = uri => { - t.same(uri, npm.config.get('registry'), 'gets credentials for expected registry') - return { token: 'some.registry.token' } - } const publish = new Publish(npm) |