@@ -163,9 +163,9 @@ t.test('if loglevel=info and json, should not output package contents', async t
163163
164164t . test (
165165 /* eslint-disable-next-line max-len */
166- 'if loglevel=silent and dry-run, should not output package contents or publish or validate credentials , should log tarball contents' ,
166+ 'if loglevel=silent and dry-run, should not output package contents or publish, should log tarball contents' ,
167167 async t => {
168- t . plan ( 1 )
168+ t . plan ( 2 )
169169
170170 const testDir = t . testdir ( {
171171 'package.json' : JSON . stringify (
@@ -199,8 +199,9 @@ t.test(
199199 throw new Error ( 'should not output in dry run mode' )
200200 } ,
201201 } , t )
202- npm . config . getCredentialsByURI = ( ) => {
203- throw new Error ( 'should not call getCredentialsByURI in dry run' )
202+ npm . config . getCredentialsByURI = uri => {
203+ t . same ( uri , npm . config . get ( 'registry' ) , 'gets credentials for expected registry' )
204+ return { token : 'some.registry.token' }
204205 }
205206
206207 const publish = new Publish ( npm )
@@ -213,7 +214,7 @@ t.test(
213214 /* eslint-disable-next-line max-len */
214215 'if loglevel=info and dry-run, should not publish, should log package contents and log tarball contents' ,
215216 async t => {
216- t . plan ( 2 )
217+ t . plan ( 3 )
217218
218219 const testDir = t . testdir ( {
219220 'package.json' : JSON . stringify (
@@ -247,9 +248,11 @@ t.test(
247248 t . pass ( 'output fn is called' )
248249 } ,
249250 } , t )
250- npm . config . getCredentialsByURI = ( ) => {
251- throw new Error ( 'should not call getCredentialsByURI in dry run' )
251+ npm . config . getCredentialsByURI = uri => {
252+ t . same ( uri , npm . config . get ( 'registry' ) , 'gets credentials for expected registry' )
253+ return { token : 'some.registry.token' }
252254 }
255+
253256 const publish = new Publish ( npm )
254257
255258 await publish . exec ( [ testDir ] )
0 commit comments