File tree Expand file tree Collapse file tree 1 file changed +18
-10
lines changed Expand file tree Collapse file tree 1 file changed +18
-10
lines changed Original file line number Diff line number Diff line change @@ -227,6 +227,18 @@ t.test(
227
227
) ,
228
228
} )
229
229
230
+ const npm = mockNpm ( {
231
+ config : { 'dry-run' : true , loglevel : 'info' } ,
232
+ output : ( ) => {
233
+ t . pass ( 'output fn is called' )
234
+ } ,
235
+ } , t )
236
+ const registry = npm . config . get ( 'registry' )
237
+ npm . config . getCredentialsByURI = uri => {
238
+ t . same ( uri , registry , 'gets credentials for expected registry' )
239
+ return { /* no token will call log.warn */ }
240
+ }
241
+
230
242
const Publish = t . mock ( '../../../lib/commands/publish.js' , {
231
243
'../../../lib/utils/tar.js' : {
232
244
getContents : ( ) => ( {
@@ -235,23 +247,19 @@ t.test(
235
247
logTar : ( ) => {
236
248
t . pass ( 'logTar is called' )
237
249
} ,
250
+ 'proc-log' : {
251
+ warn ( _ , msg ) {
252
+ t . match ( msg ,
253
+ `This command requires you to be logged in to ${ registry } (dry-run)` )
254
+ } ,
255
+ } ,
238
256
} ,
239
257
libnpmpublish : {
240
258
publish : ( ) => {
241
259
throw new Error ( 'should not call libnpmpublish in dry run' )
242
260
} ,
243
261
} ,
244
262
} )
245
- const npm = mockNpm ( {
246
- config : { 'dry-run' : true , loglevel : 'info' } ,
247
- output : ( ) => {
248
- t . pass ( 'output fn is called' )
249
- } ,
250
- } , t )
251
- npm . config . getCredentialsByURI = uri => {
252
- t . same ( uri , npm . config . get ( 'registry' ) , 'gets credentials for expected registry' )
253
- return { token : 'some.registry.token' }
254
- }
255
263
256
264
const publish = new Publish ( npm )
257
265
You can’t perform that action at this time.
0 commit comments