@@ -163,9 +163,9 @@ t.test('if loglevel=info and json, should not output package contents', async t
163
163
164
164
t . test (
165
165
/* 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' ,
167
167
async t => {
168
- t . plan ( 1 )
168
+ t . plan ( 2 )
169
169
170
170
const testDir = t . testdir ( {
171
171
'package.json' : JSON . stringify (
@@ -199,8 +199,9 @@ t.test(
199
199
throw new Error ( 'should not output in dry run mode' )
200
200
} ,
201
201
} , 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' }
204
205
}
205
206
206
207
const publish = new Publish ( npm )
@@ -213,7 +214,7 @@ t.test(
213
214
/* eslint-disable-next-line max-len */
214
215
'if loglevel=info and dry-run, should not publish, should log package contents and log tarball contents' ,
215
216
async t => {
216
- t . plan ( 2 )
217
+ t . plan ( 3 )
217
218
218
219
const testDir = t . testdir ( {
219
220
'package.json' : JSON . stringify (
@@ -247,9 +248,11 @@ t.test(
247
248
t . pass ( 'output fn is called' )
248
249
} ,
249
250
} , 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' }
252
254
}
255
+
253
256
const publish = new Publish ( npm )
254
257
255
258
await publish . exec ( [ testDir ] )
0 commit comments