Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/npm/cli.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorLuke Karrys <luke@lukekarrys.com>2022-04-11 08:21:17 +0300
committerNathan Fritz <fritzy@github.com>2022-04-14 00:30:39 +0300
commit5ba7f0cef753d4af0bc02ca7d6dd0ac1bdd11ffe (patch)
tree7300133899a933b985a32f57989129ab304e6ea5 /test
parent06eff18d8a8f1ed41e91eb747f9c03e76d953353 (diff)
fix: show more information during publish dry-run
Fixes #4317
Diffstat (limited to 'test')
-rw-r--r--test/lib/commands/publish.js17
1 files changed, 10 insertions, 7 deletions
diff --git a/test/lib/commands/publish.js b/test/lib/commands/publish.js
index 0acce8b00..e266ea524 100644
--- a/test/lib/commands/publish.js
+++ b/test/lib/commands/publish.js
@@ -163,9 +163,9 @@ t.test('if loglevel=info and json, should not output package contents', async t
t.test(
/* eslint-disable-next-line max-len */
- 'if loglevel=silent and dry-run, should not output package contents or publish or validate credentials, should log tarball contents',
+ 'if loglevel=silent and dry-run, should not output package contents or publish, should log tarball contents',
async t => {
- t.plan(1)
+ t.plan(2)
const testDir = t.testdir({
'package.json': JSON.stringify(
@@ -199,8 +199,9 @@ t.test(
throw new Error('should not output in dry run mode')
},
}, t)
- npm.config.getCredentialsByURI = () => {
- throw new Error('should not call getCredentialsByURI in dry run')
+ 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)
@@ -213,7 +214,7 @@ t.test(
/* eslint-disable-next-line max-len */
'if loglevel=info and dry-run, should not publish, should log package contents and log tarball contents',
async t => {
- t.plan(2)
+ t.plan(3)
const testDir = t.testdir({
'package.json': JSON.stringify(
@@ -247,9 +248,11 @@ t.test(
t.pass('output fn is called')
},
}, t)
- npm.config.getCredentialsByURI = () => {
- throw new Error('should not call getCredentialsByURI in dry run')
+ 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)
await publish.exec([testDir])